This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export type Curry<F extends (...args: readonly unknown[]) => unknown> = | |
| Parameters<F> extends readonly [infer First, ...infer Rest] | |
| ? (arg: First) => Rest extends readonly [] | |
| ? ReturnType<F> | |
| : Curry<(...args: Rest) => ReturnType<F>> | |
| : ReturnType<F>; | |
| export function curry<F extends (...args: readonly unknown[]) => unknown>(fn: F): Curry<F> { | |
| function curried(...providedArgs: readonly unknown[]): unknown { | |
| if (providedArgs.length >= fn.length) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This is best when used in conjunction with the Injector chrome extension: | |
| # http://neocotic.com/injector | |
| # | |
| # Add this snippet of code and launch Chrome or Canary in no sec mode: | |
| # | |
| # alias chrome-nosec="open /Applications/Google\ Chrome.app --args --disable-web-security --disable-prompt-on-repost" | |
| # alias canary-nosec="open /Applications/Google\ Chrome\ Canary.app --args --disable-web-security --disable-prompt-on-repost" | |
| # | |
| # Then pretty much just keep your dev console open and everytime you visit a page in the SDB, the code will | |
| # automatically reach out to the JellyNeo item database and tell you if anything in your SDB is worth over x nps. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Michael Scott Hertzberg <mshertzberg@gmail.com> (http://hertzber.gs) | |
| * | |
| * recursively check for set localStorage value every 100ms. | |
| * this will also safely clear the timeout once found. | |
| * can be used callback style or directly. | |
| * functionally pure. | |
| */ | |
| function waitForLocalStorage(key, cb, timer) { | |
| if (!localStorage.getItem(key)) return (timer = setTimeout(waitForLocalStorage.bind(null, key, cb), 100)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var music, musicParse; | |
| musicParse = function(f) { | |
| return eval("for(var t=0,S='RIFF_oO_WAVEfmt " + atob('EAAAAAEAAQBAHwAAQB8AAAEACAA') + "data';++t<3e5;)S+=String.fromCharCode(" + f + ")"); | |
| }; | |
| music = function() { | |
| var audio, formula; | |
| formula = '(t<<3)*[8/9,1,9/8,6/5,4/3,3/2,0][[0xd2d2c8,0xce4088,0xca32c8,0x8e4009][t>>14&3]>>(0x3dbe4688>>((t>>10&15)>9?18:t>>10&15)*3&7)*3&7]&255'; | |
| audio = new Audio("data:audio/wav;base64," + (btoa(musicParse(formula)))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Heart { | |
| constructor() { | |
| this.states = { | |
| REST: 'Resting', | |
| CONTRACTION: 'Contracting', | |
| RELAXATION: 'Relaxing' | |
| }; | |
| this.transitions = { | |
| [this.states.REST]: [this.states.CONTRACTION, 'Ventricles contract', 'Valves open'], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| https://2ality.com/feeds/posts.atom | |
| https://aws.amazon.com/blogs/architecture/feed/ | |
| https://blog.bitsrc.io/feed | |
| https://deno.com/feed | |
| https://escape.tech/blog/rss/ | |
| https://feeds.feedburner.com/EsnextNews | |
| https://frontendmastery.com/feed | |
| https://hacklewayne.com/rss/index.xml | |
| https://jser.dev/rss.xml | |
| https://keithjgrant.com/posts/index.xml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var i, arr = [1, 2, 3, 4, 5, 6, 7, 8]; | |
| for(i = 0; i < arr.length / 2; i++) { | |
| var temp = arr[i]; | |
| arr[i] = arr[arr.length - i - 1] | |
| arr[arr.length - i - 1] = tmp | |
| } | |
| /* | |
| passes: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const o = { a: true }; | |
| [...Array(9)].map(Function.prototype.valueOf, o); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function traverseDOMNodes(node, predicates, cb) { | |
| if (predicates.length === 0) { | |
| // Base case: If there are no more predicates, invoke the callback. | |
| return cb(node); | |
| } | |
| const [currentPredicate, ...remainingPredicates] = predicates; | |
| const children = node.childNodes; | |
| for (let child of children) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // O(1) | |
| const todo = (state, action) => { | |
| const actions = { | |
| ADD_TODO: () => { | |
| return { | |
| id: action.id, | |
| text: action.text, | |
| completed: false | |
| } | |
| }, |
NewerOlder