This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
| 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) { |