This file contains 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 say = sentence => speechSynthesis.speak(new SpeechSynthesisUtterance(sentence)); |
This file contains 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 fact = n => n ? fact(n - 1) * n : 1; | |
const poisson = (l, k) => (l ** k / fact(k)) * Math.E ** -l; |
This file contains 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 fact = n => n ? fact(n - 1) * n : 1; | |
const coefficients = (n,k) => Math.round(fact(n) / (fact(k) * fact(n - k))); | |
const binomial = (p, n, k) => coefficients(n, k) * (p ** k) * ((1 - p) ** (n - k)); |
This file contains 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
cargo watch -x 'run' -q -c -d 1 |
This file contains 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 fact = n => n ? fact(n - 1) * n : 1; | |
Math.round(fact(90) / (fact(5) * fact(90 - 5)) * (1 ** 5) * (1 ** 85)).toLocaleString(); |
This file contains 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 const railway = (semaphore = () => false) => (begin, ...calls) => | |
calls.reduce( | |
(value, call) => semaphore(value) ? value : call(value) | |
, begin) | |
; |
This file contains 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 default (inner, ...outers) => outers.reduce((result, calc) => calc(result), inner); |
This file contains 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
/* five digit random radix32 ID */ | |
function GUID32(){ return ('0'.repeat(5)+( ~~(Math.random() * parseInt( 10e4 , 32 )) ).toString(32).toUpperCase()).slice( -5 ) }; |
This file contains 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
dice=$=>~~(Math.random()*($?$:6))+1 |
This file contains 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
/* # use >> for( node of Object.walk( yourObject )) console.log( node ) | |
# or more >> | |
let walk=[]; for( node of Object.walk( yourObject , o => isHaveRoutes( o ) ) ) if(isProperWay(node)) walk.push( node ) | |
# recursive generator for Object, avoide circular structure by set. | |
*/ |