Skip to content

Instantly share code, notes, and snippets.

View lalosh's full-sized avatar

Louay Al-osh lalosh

View GitHub Profile
@lalosh
lalosh / calculateHmac.js
Last active May 30, 2022 12:53 — forked from mikaturunen/calculateHmac.js
Example of calculating hmac in node.js
import * as crypto from 'crypto'
const merchantSecret = 'secret'
const hash = 'sha256'
const encoding = 'base64'
const payload = {
id: 123,
somethingElse: 'not 123'
}
console.log('challenge accepted');
let x = {
// save the real value
_value: 0,
// get the value implicity when needed
valueOf: function getX() {
return (x._value += 5);
}
}
@lalosh
lalosh / lodash-debounce-with-cancellation.js
Created August 11, 2021 12:30
Lodash debounce with cancellation
// Copyright 2021 Lableb
/**
* Lodash debounce with cancellation capabilities
*
* @author Louay Al-osh
*/