Skip to content

Instantly share code, notes, and snippets.

View ryardley's full-sized avatar

гλ ryardley

View GitHub Profile
const Switch = (props) => <span>{props.children}</span>;
const Case = (props) => props.expr && props.children;
const TestInstantiated = (props) => {
console.log(`${props.id}: I was rendered`);
return <div>{props.id}</div>;
}
function TestSwitch() {
const val = 3;
const Switch = (props) => <span>{props.children}</span>;
const Case = (props) => props.expr && props.children;
function TestSwitch() {
const val = 3;
return (
<Switch>
<Case expr={val === 1}>
function one(){
console.log('do one');
}
function two(){
console.log('do two');
}
function three(){
console.log('do three');
@ryardley
ryardley / redux_simplification_1.js
Created June 16, 2016 08:57
Exploring redux alternatives
import React, { PropTypes } from 'react';
import ReactDOM from 'react-dom';
import { Observable, Subject } from 'rxjs/Rx';
const stateEmitter = new Subject();
const state$ = Observable.from(stateEmitter);
const sendEvent = (data) => () => {
stateEmitter.next({
@ryardley
ryardley / gist:f1df91251c1caf03464b
Created March 28, 2015 08:53
fat arrow of perplexity
Promise.all(this.routes.filter(route => !!route).map(route => new Promise((resolve, reject) => this.context.executeAction(route.data, state, () => resolve())).then(() => callback(null));
@ryardley
ryardley / SassMeister-input-HTML.html
Last active August 29, 2015 14:15
Generated by SassMeister.com.
<html>
<body class="Page-outer">
<div class="Page-inner">
<header class="PageHeader">
<h1 class="PageHeader-h1">Foo meets Baz in a Bar...</h1>
</header>
<section class="PageLayout-content">
<h1>HTML Ipsum Presents</h1>
<p><strong>Pellentesque habitant morbi tristique</strong> senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. <em>Aenean ultricies mi vitae est.</em> Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, <code>commodo vitae</code>, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. <a href="#">Donec non enim</a> in turpis pulvinar facilisis. Ut felis.</p>
@ryardley
ryardley / SassMeister-input-HTML.html
Created February 22, 2015 12:31
Generated by SassMeister.com.
<html>
<div class="MyMedia">
<img class="MyMedia-left" src="https://avatars3.githubusercontent.com/u/1256409?v=3&s=460" />
<div class="MyMedia-right">
<h1 class="MyMedia-h1">Beer me</h1>
<p>Flexitarian bitters Pitchfork tofu, PBR synth taxidermy sartorial artisan. Banksy letterpress direct trade polaroid fingerstache. Yr organic VHS, fixie gluten-free scenester ethical Williamsburg</p>
<p class="MyMedia-more">More...</p>
</div>
</div>
</html>
var msg = 'hello world';
function doSomething(){
var msg = 'foo';
function inner(){
return msg;
}
return inner();
}
expect(msg).toEqual('hello world');