Skip to content

Instantly share code, notes, and snippets.

View chee's full-sized avatar
🍕
partying

chee chee

🍕
partying
View GitHub Profile
function curry(fn) {
return function curried(...args) {
if (args.length >= fn.length) {
return fn(...args)
} else {
return (...nextArgs) => curried(...args, ...nextArgs)
}
}
}
#!/bin/sh
name="$1"
mkdir $name
cd $name
yarn init -y
yarn add --dev babel-preset-react-app babel-plugin-transform-es2015-modules-commonjs
yarn add react react-dom
cat <<LOL > .babelrc
data = require('./data.json')
escape = char => `\\${char}`
special = new RegExp(
'[' +
'( ) { } [ ] | \\ ^ $ * + ? .'
.split``
.map(escape)
.join('|') +
data = require('./data.json')
escape = char => `\\${char}`
special = new RegExp(
'[' +
'( ) { } [ ] | \\ ^ $ * + ? .'
.split``
.map(escape)
.join('|') +
data = require('./data.json')
escape = char => `\\${char}`
special = new RegExp(
'[' +
'( ) { } [ ] | \\ ^ $ * + ? .'
.split``
.map(escape)
.join('|') +
@chee
chee / bigify.js
Last active August 14, 2018 13:36 — forked from rowanmanning/bigify.js
Bigify
#!/usr/bin/env node
charactermap = new Proxy({
' ': 'blank',
'?': 'question',
'!': 'exclamation'
}, {
get: (object, key) =>
key in object
? object[key]
// bizarguments is a v8 anomaly
function abc() {
return def();
}
function def() {
return abc.arguments[0] * 2;
}
abc(50); // >> 100
@chee
chee / lol.json
Last active September 6, 2018 16:04
{
"lol": "hi",
"array": ["a", "b", "c"]
}
@chee
chee / curry-golf.js
Last active September 14, 2018 15:17
curry
l='length';c=f=>function c(...a){return a[l]>=f[l]?f(...a):(...n)=>c(...a,...n)}
@chee
chee / number-words.js
Last active September 15, 2018 16:34
function deconstructor({words, number, base}) {
const which = Math.log(number) / Math.log(base) | 0
const amount = Math.pow(base, which)
const prefix = number / amount | 0
const round = amount * prefix
return {
number: prefix,
remainder: number - round,
word: words[which]
}