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
| import java.util.HashMap; | |
| import java.util.LinkedList; | |
| import java.util.List; | |
| import java.util.Map; | |
| import java.util.Random; | |
| import java.util.concurrent.ConcurrentHashMap; | |
| import java.util.concurrent.ThreadLocalRandom; | |
| public class ReadWriteTimeTest | |
| { |
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
| <!doctype html> | |
| <html><head><script src="app.js"></script></head><body></body></html> |
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
| -- Pre-made array for resetting the P1 joypad | |
| local reset = joypad.get(1) | |
| for k,v in pairs(reset) do | |
| reset[k] = '' | |
| end | |
| event.onframestart( function() | |
| local p1 = joypad.get(1) | |
| local p2 = joypad.get(2) | |
| local consolidated = intersection(p1, p2) |
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
| -- Array of controller modes. We will switch | |
| -- between the three of these randomly | |
| local mode = {"P1", "P2", "ZEN"} | |
| local current = mode[1] | |
| -- Pre-made array for resetting the P1 joypad | |
| local reset = joypad.get(1) | |
| for k,v in pairs(reset) do | |
| reset[k] = '' | |
| end |
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
| // Tiny, recursive autocurry | |
| const curry = ( | |
| f, arr = [] | |
| ) => (...args) => ( | |
| a => a.length === f.length ? | |
| f(...a) : | |
| curry(f, a) | |
| )([...arr, ...args]); |
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 compose = (...fns) => x => fns.reduceRight((y, f) => f(y), x); | |
| const trace = label => value => { | |
| console.log(`${ label }: ${ value }`); | |
| return value; | |
| }; | |
| const g = n => n + 1; | |
| const f = n => n * 2; |
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
| // ************************************************** | |
| // Lib code | |
| // ************************************************** | |
| function chainer(errHandler, functions) { | |
| // Copy functions array so rChainer doesn't modify the referenced array | |
| return (...input) => rChainer(errHandler, [...functions], ...input); | |
| } | |
| function rChainer(errHandler, functions, ...input) { | |
| let func = functions.shift();; |
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
| interface example { | |
| "a": number, | |
| "b": string, | |
| "c": {x: number, y: string, z: any }, | |
| "d": {val: keyof example} | |
| } | |
| function test<T extends keyof example> (p1: T, p2: example[T]): void { | |
| console.log(p1, p2); | |
| } |
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
| type SimpleExample = 1 | 2 | 'a'; | |
| type ConditionalExample<T> = T extends number ? T : never; | |
| type T = ConditionalExample<SimpleExample> // '1' | '2' | |
| ///////////////////////////////////////////////////////////////////////////// | |
| // Filter out keys from TRecord which's value matches type of TMatch | |
| type MatchingKeys< | |
| TRecord, | |
| TMatch, | |
| K extends keyof TRecord = keyof TRecord |
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
| git fetch; | |
| git pull; | |
| TRACKING=$(git remote show origin | grep 'HEAD branch' | cut -d ':' -f 2 | sed 's# ##'); | |
| echo Checking out $REPO:$TRACKING; | |
| git checkout -q $TRACKING; | |
| git pull; |
OlderNewer