I hereby claim:
- I am therealklanni on github.
- I am therealklanni (https://keybase.io/therealklanni) on keybase.
- I have a public key ASBtBpAqGlRXLoRQ-cZhbgTarUvu5VJIqMslZcPK0W6Bpgo
To claim this, I am signing this object:
# Remove stale modules directories, fast! | |
# | |
# Paste or source this file in your shell rc file (should work with Bash and ZSH) | |
# | |
# Optionally provide a path as first arg, and optionally a duration in days as second arg (default=30) | |
# e.g. clean_modules ~/github 60 | |
# Remove the "-exec du" line for faster operation (i.e. do not print sizes, which can be slow) | |
PROJECT_DIR=~/Projects | |
# If `bfs` is installed, use that for faster searching |
import { sudokuVerifier } from '../src/sudoku_verifier' | |
import problems, { sudoku } from '../problems' | |
function assertValid(problem, solution) { | |
expect( | |
sudokuVerifier({ problem, solution }) | |
).toEqual({ status: 'valid', invalidIndexes: [ ] }) | |
} | |
function assertIncomplete(problem, solution) { |
I hereby claim:
To claim this, I am signing this object:
import { rollup } from 'rollup'; | |
import babel from 'rollup-plugin-babel'; | |
rollup({ | |
entry: 'index.js', | |
plugins: [ babel({ presets: [ 'es2015-rollup' ] }) ] | |
}).then(bundle => Promise.all([ | |
bundle.write({ | |
dest: 'dist/module.js', | |
format: 'cjs', |
import { rollup } from 'rollup'; | |
import babel from 'rollup-plugin-babel'; | |
rollup({ | |
entry: 'index.js', | |
plugins: [ babel({ presets: ['es2015-rollup'] }) ] | |
}).then(bundle => bundle.write({ | |
dest: 'dist/module.js', | |
format: 'cjs', | |
sourceMap: 'inline' |
function asyncQuicksort(xs = []) { | |
// get the "head" and "tail" of the array | |
let [h, ...t] = xs | |
// create the initial Promise | |
return new Promise((res, rej) => { | |
// resolve immediately if "head" was undefined | |
if (!h) return res([]) | |
// recurse for the "left" half of the partition | |
asyncQuicksort(t.filter(a => a <= h)).then(a => { | |
// recurse for the "right" half of the partition |
// pronounce Yl like "while" ;) | |
let Yl = Y(f => (g, i) => { | |
let r = g(i - 1) | |
return r !== false ? r : f(g, i - 1) | |
}) | |
// extremely contrived example using Yl | |
let people = [ 'Shannon', 'Joseph', 'Eric', 'Mike'] |
// original | |
const Y = f => (x => f(v => x(x)(v)))(x => f(v => x(x)(v))) | |
// expanded as | |
const Y = f => { | |
// return the result of this IIFE | |
// f produces the fixed point function | |
return (x => { | |
// outer: | |
f(v => { |
const Yfact = Y(inner => n => n <= 1 ? n : n * inner(n - 1)) | |
console.log(Yfact) | |
// n => n <= 1 ? n : n * inner(n - 1) |