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
export default [ | |
{title: 'red', message: 'I\'m red', color: 'red'}, | |
{title: 'blue', message: 'I\'m blue', color: 'blue'}, | |
{title: 'green', message: 'I\'m green', color: 'green'} | |
] |
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 {get as getFormData} from './form-data.js'; | |
class FormComp extends Component { | |
constructor(props) { | |
super(props); | |
this.inputs = getFormDate({omit: ['zipcode']}).map((inputData, i) => <Input {...inputData} key={`form_comp_${i}`} required />); | |
} | |
render() { | |
return ( |
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
@provideReactor(provideContextProps) | |
class Wrapper extends Component { | |
static propTypes = { | |
children: PropTypes.array.isRequired | |
}; | |
render() { | |
<div> | |
{this.props.children} | |
</div> |
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
/* | |
* Objects | |
*/ | |
const props = { | |
1: 1, | |
2: 2, | |
3: 3, | |
4: 4 | |
} | |
const {a,b, ...rest} = props //a = 1, b = 2, rest = {3: 3, 4: 4} |
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
//colors | |
/^(?:#?[a-f\d]+|[a-s]{1,4}\s?\([\d%\s,.]+\))$/i | |
'hsla(0, 10%, 50%, 0.5)' | |
'#000000000' | |
'#11111' | |
'argb(1,1,1)' | |
'hsl (20,0%, 50%)' | |
'hsl(20, 20%, 20%)' | |
'#6F6F6F' |
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 request from 'superagent'; | |
import cheerio from 'cheerio'; | |
import vo from 'vo'; | |
import {readFile} from 'fs'; | |
/** | |
* An example generator | |
*/ | |
function *gen(init) { | |
//confusing because what is stored in `first` variables is not what is returned from |
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 fromSpawn = spawn(function *() { | |
const someVal = yield new Promise((res, rej) => { | |
setTimeout(res.bind(null, 'whatevs!!!'), 1000); | |
}); | |
bloooBlaahhh | |
}); | |
fromSpawn.then((data) => { | |
console.log('Data from spawn', data); |
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 fromSpawn = spawn(function *() { | |
let rejValFirst, rejValSecond, resValLast; | |
try { | |
rejValFirst = yield new Promise((res, rej) => { | |
setTimeout(rej.bind(null, 'blaaa...first rejected!!!'), 1000); | |
}); | |
} catch (err) { | |
console.error('Inside spawn error', err); |
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 spawn(gen) { | |
const it = gen(); | |
function _co(method, arg) { | |
let res; | |
try { | |
console.log('***TRY***', method, arg); | |
res = it[method](arg); | |
} catch(err) { |