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
const templates = { | |
index: name => `// @flow | |
import React from 'react'; | |
import './${name}.css'; | |
// TODO: write rest of ${name} component | |
const ${name} = () => ( | |
<div className="${name.toLowerCase()}"> | |
<span>rest of component</span> |
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
const chokidar = require("chokidar"); | |
const fs = require("fs"); | |
const templates = { | |
index: name => | |
`// @flow | |
import React from 'react'; | |
import './${name}.css'; |
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
Show hidden characters
{ | |
"presets": [ | |
"react", | |
"flow" | |
], | |
"retainLines": true | |
} |
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 getRandomInt(max) { // From MDN | |
return Math.floor(Math.random() * Math.floor(max)); | |
} | |
const length = array => array.length | |
const verbs = ['smell', 'fart', 'look', 'move', 'eat', 'walk', 'talk', 'sleep', 'smile'] | |
const presentSimpleVerbs = ['worries', 'sings', 'cooks', 'fidgets', 'wriggles', 'dances', 'runs', 'sets stuff on fire'] | |
const nouns = ['house', 'dog', 'poop', 'worm', 'lawyer', 'little girl', 'piece of cheese', 'french poodle'] | |
const timeRelatedAdverbs = ['always', 'never', 'sometimes', 'often', 'rarely', 'occasionally'] |
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
// https://mostly-adequate.gitbooks.io/mostly-adequate-guide/ch03.html#the-case-for-purity | |
const memoize = (f) => { | |
const cache = {}; | |
return (...args) => { | |
const argStr = JSON.stringify(args); | |
cache[argStr] = cache[argStr] || f(...args); | |
console.log(cache) // added for checking out the cache | |
return cache[argStr]; | |
}; |
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
window.c = (type, text) => { | |
let e = document.createElement(type) | |
e.innerText = text | |
return e | |
} | |
window.i = (c) => document.body.insertBefore(c,document.body.firstChild) | |
i(c('style', `*{animation: FadeIn 0.5s} @keyframes FadeIn{0% {opacity: 0;transform: translateX(-20px);}}`)) |
NewerOlder