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
| // Available variables: | |
| // - Machine | |
| // - interpret | |
| // - assign | |
| // - send | |
| // - sendParent | |
| // - spawn | |
| // - raise | |
| // - actions |
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
| Coverage Badges |
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 NormDist = (avg, stdev) => { | |
| const { E, sqrt } = Math; | |
| const variance = stdev ** 2; | |
| const stdevTau = stdev * sqrt(2 * Math.PI); | |
| const doubleVariance = 2 * variance; | |
| return (x) => { | |
| const distFromAvg = (x - avg) ** 2; | |
| return ( | |
| (E ** -(distFromAvg / doubleVariance)) / stdevTau |
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
| // the actual union function | |
| const union = types => types.reduce((prev, type) => ({ | |
| ...prev, | |
| [type]: data => ({ | |
| match: fns => fns[type](data), | |
| }) | |
| }), {}); | |
| const kinds = [ |
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
| /* assumes 1 value in, 1 value out */ | |
| const reducing = (dir = 'reduce') => (...funcs) => (value) => funcs[dir]( | |
| (v, fn) => fn(v), | |
| value | |
| ); | |
| const compose = reducing('reduceRight'); | |
| const pipe = reducing(); | |
| const tap = fn => value => { fn(value); return value; }; |
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
| // === Arrays | |
| var [a, b] = [1, 2]; | |
| console.log(a, b); | |
| //=> 1 2 | |
| // Use from functions, only select from pattern | |
| var foo = () => { | |
| return [1, 2, 3]; |
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 fs = require('fs'), | |
| http = require('http'), | |
| https = require('https'), | |
| httpProxy = require('http-proxy'); | |
| var isHttps = true; // do you want a https proxy? | |
| var options = { | |
| https: { | |
| key: fs.readFileSync('key.pem'), |
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
| // ---- | |
| // Sass (v3.4.1) | |
| // Compass (v1.0.1) | |
| // ---- | |
| $bgColor: #333; | |
| ::selection { | |
| background: $bgColor; | |
| color: #fff; |
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
| //------------------------------------------------------------- | |
| // | |
| // Hypothesis: | |
| // | |
| // Promises/A is a Monad | |
| // | |
| // To be a Monad, it must provide at least: | |
| // - A unit (aka return or mreturn) operation that creates a corresponding | |
| // monadic value from a non-monadic value. | |
| // - A bind operation that applies a function to a monadic value |