Skip to content

Instantly share code, notes, and snippets.

View evanrs's full-sized avatar
🏋️‍♂️
Focusing

Evan Schneider evanrs

🏋️‍♂️
Focusing
View GitHub Profile
@evanrs
evanrs / .eslintrc
Last active August 29, 2015 14:22 — forked from cletusw/.eslintrc
{
// http://eslint.org/docs/rules/
"ecmaFeatures": {
"binaryLiterals": false, // enable binary literals
"blockBindings": false, // enable let and const (aka block bindings)
"defaultParams": false, // enable default function parameters
"forOf": false, // enable for-of loops
"generators": false, // enable generators
"objectLiteralComputedProperties": false, // enable computed object literal property names
@evanrs
evanrs / rewriting-history-with-predicates.md
Last active November 4, 2015 07:14
Rewriting history with predicates (Reactive 2015 lightning talk proposal)

This is a proposal for a lightning talk I would give at the Reactive 2015 conference.

NOTE: If you like it, put a star ⭐ on it—the number of stars decides if it makes the cut!

Rewriting history with predicates

Redux provides a simple pattern for managing application state. As demonstrated in Dan Abramov's talk following this pattern lets you painlessly implement simple undo and time travel. By keeping a history of actions, and reducing a subset

router.run((Handler, routerState) => {
store.dispatch({
type: 'EVERYTHING_IS_AWESOME',
})
React.render(
<Provider store={store}>
{() => <Handler router={router} routerState={routerState}/>}
</Provider>, appElement);
});
import result from 'lodash/object/result';
function decomposeProperty (style, propName) {
if (arguments.length < 2)
return decomposeProperty.bind(this, ...arguments);
let prop = style[propName];
if (! prop) {
return false;
"use strict";
var _interopRequireDefault = require("babel-runtime/helpers/interop-require-default")["default"];
exports.__esModule = true;
var _leven = require("leven");
var _leven2 = _interopRequireDefault(_leven);
@evanrs
evanrs / recurry.js
Created February 22, 2016 20:18
Method to create function trees that curry to their parent.
import assign from "lodash/assign";
import functions from "lodash/functions";
export function recurry (fn, fns={}) {
fn = assign(fn, fns);
return function () {
if (arguments.length < fn.length) {
const bound = fn.bind(null, ...arguments);
functions(fn).map((key) =>
@evanrs
evanrs / react-poll.js
Created February 26, 2016 17:42
Poll at interval or on window focus, throttle between interval and focus events.
import React, { Component, PropTypes } from 'react'
import throttle from 'lodash/throttle';
import attempt from 'lodash/attempt';
class Poll extends Component {
static propTypes = {
throttle: PropTypes.number,
interval: PropTypes.number,
onFocus: PropTypes.func,
onInterval: PropTypes.func
@evanrs
evanrs / flatMapObject.js
Last active June 7, 2017 04:22
Functions
import flatMap from 'lodash/flatMap';
import keys from 'lodash/keys';
import get from 'lodash/get';
import identity from 'lodash/identity';
import isArray from 'lodash/isArray';
import isDate from 'lodash/isDate';
import isFunction from 'lodash/isFunction';
import isObject from 'lodash/isObject';
import map from 'lodash/map';
import zipObject from 'lodash/zipObject';

Keybase proof

I hereby claim:

  • I am evanrs on github.
  • I am evanrs (https://keybase.io/evanrs) on keybase.
  • I have a public key ASCWQiYWNQfKYm_IU6kYzsc1TDyhn5m05a_ktY0_OqR3FQo

To claim this, I am signing this object:

@evanrs
evanrs / README.md
Last active December 13, 2016 08:04
Use React in an Angular app

ngReactComponent

Use React in an Angular app.

Bindings are automatically derived from propTypes.

const ngSuchComponent =
  ngReactBridge.create(SuchComponent);