Skip to content

Instantly share code, notes, and snippets.

View herberthk's full-sized avatar
🏠
Full stack developer

Kavuma Herbert herberthk

🏠
Full stack developer
View GitHub Profile
@rajinder-yadav
rajinder-yadav / nodejs-https-requests.js
Last active October 26, 2023 18:55
Node.js making a HTTPS request with GET and POST
const https = require('https');
async function httpsGet(hostname, path, headers) {
return new Promise(async (resolve, reject) => {
const options = {
hostname: hostname,
path: path,
port: 443,
method: 'GET',
@AlixBou
AlixBou / MainApplication.java
Last active August 11, 2020 19:25
How to use turbo module within java code
import com.facebook.react.ReactApplication ;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.ReactPackage;
import com.facebook.react.TurboReactPackage;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.module.model.ReactModuleInfo;
import com.facebook.react.module.model.ReactModuleInfoProvider;
import com.facebook.react.shell.MainReactPackage;
/**
* function ListNode(val) {
* this.val = val;
* this.next = null;
* }
*/
var mergeTwoLists = function(l1, l2) {
const dummy = new ListNode(0);
let current = dummy;
@CodeDraken
CodeDraken / JS-Essentials-Objects.js
Created October 9, 2018 20:00
Code for JavaScript Essentials: Objects
// Wolf
// - Properties
// -- fur color
// -- eye color
// -- size
// -- gender
// -- age
// - Actions
// -- walk/run
@NeuTrix
NeuTrix / Codility: PermCheck. JavaScript solution
Created July 12, 2018 02:46
A simple javascript solve to the Codility PermCheck challenge
// ===== ANSWER:
function solution(A) {
let set = new Set(); // holds a unique set of values
let max = 1; // largest number in set
let min = 1; // smallest number in set
let n = A.length
for (let i = 0; i < n; i += 1) {
let num = A[i];
@adicuco
adicuco / PassingCars.js
Created June 16, 2018 15:09
100 % solution for Passing Cars Task on Codility
function solution(A) {
var zero = 0;
var count = 0;
for (var i = 0; i < A.length; i++) {
if (A[i] == 0) zero++;
else {
count += 1 * zero;
if (count > 1000000000) return -1;
}
@lasverg
lasverg / diagonal-difference.js
Last active May 29, 2023 06:34
Diagonal Difference | Solution | JavaScript
/*
Diagonal Difference Solution.
sample matrix = [[1,2,3], [4,5,6], [7,8,9]]
*/
function diagonalDifference(matrix) {
// length of input matrix.
const length = matrix.length;
let diagonal1 = 0, diagonal2 = 0;
// Looping through the array and summing the diagonals.
@bradtraversy
bradtraversy / sample.md
Created March 23, 2018 18:17
Markdown Cheat Sheet

Heading 1

Heading 2

Heading 3

Heading 4

Heading 5
Heading 6

This text is italic

@lienista
lienista / 242-leetcode-valid-anagram.js
Last active February 25, 2021 05:35
(Algorithms in Javascript) Leetcode 242. Valid Anagram - Given two strings s and t , write a function to determine if t is an anagram of s.
const isAnagram => (s, t) {
var lens = s.length,
lent = t.length;
if(lens !== lent) return false;
if(typeof s !== 'string' || typeof t !== 'string') return false;
if(lens === 0 && lent === 0) return true;
var charmap = {};
for(let i=0; i<lens; i++){
charmap[s[i]] = charmap[s[i]] ? charmap[s[i]]+1: 1;
@steven2358
steven2358 / ffmpeg.md
Last active May 8, 2024 05:51
FFmpeg cheat sheet