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
#!/bin/bash | |
if [ "${1:0:1}" == '/' ]; then | |
dir="$(dirname $1)" | |
else | |
dir="$(pwd)/$1" | |
fi | |
project_root_files=".git .hg .project" | |
while [ "$dir" != '/' ] && [ -z "$project_root" ]; do | |
for file in $project_root_files; do |
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
function curry(fn) { | |
return function curried(...args) { | |
if (args.length >= fn.length) { | |
return fn(...args) | |
} else { | |
return (...nextArgs) => curried(...args, ...nextArgs) | |
} | |
} | |
} |
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
l='length';c=f=>function c(...a){return a[l]>=f[l]?f(...a):(...n)=>c(...a,...n)} |
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
#!/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 |
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
data = require('./data.json') | |
escape = char => `\\${char}` | |
special = new RegExp( | |
'[' + | |
'( ) { } [ ] | \\ ^ $ * + ? .' | |
.split`` | |
.map(escape) | |
.join('|') + |
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
data = require('./data.json') | |
escape = char => `\\${char}` | |
special = new RegExp( | |
'[' + | |
'( ) { } [ ] | \\ ^ $ * + ? .' | |
.split`` | |
.map(escape) | |
.join('|') + |
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
data = require('./data.json') | |
escape = char => `\\${char}` | |
special = new RegExp( | |
'[' + | |
'( ) { } [ ] | \\ ^ $ * + ? .' | |
.split`` | |
.map(escape) | |
.join('|') + |
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
#!/usr/bin/env node | |
charactermap = new Proxy({ | |
' ': 'blank', | |
'?': 'question', | |
'!': 'exclamation' | |
}, { | |
get: (object, key) => | |
key in object | |
? object[key] |
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
{ | |
"lol": "hi", | |
"array": ["a", "b", "c"] | |
} |
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
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] | |
} |