Skip to content

Instantly share code, notes, and snippets.

View chee's full-sized avatar
🍕
partying

chee chee

🍕
partying
View GitHub Profile
@chee
chee / lol.json
Last active September 6, 2018 16:04
{
"lol": "hi",
"array": ["a", "b", "c"]
}
@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]
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('|') +
#!/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
@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)}
function curry(fn) {
return function curried(...args) {
if (args.length >= fn.length) {
return fn(...args)
} else {
return (...nextArgs) => curried(...args, ...nextArgs)
}
}
}
@chee
chee / project
Last active April 29, 2017 10:46
print project root directory (takes an optional relative or absolute path, defaults to pwd)
#!/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
import hoistStatics from 'hoist-non-react-statics'
import React from 'react'
/**
* Allows two animation frames to complete to allow other components to update
* and re-render before mounting and rendering an expensive `WrappedComponent`.
*/
export default function deferComponentRender(WrappedComponent) {
class DeferredRenderWrapper extends React.Component {
constructor(props, context) {