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 / 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) =>
"use strict";
var _interopRequireDefault = require("babel-runtime/helpers/interop-require-default")["default"];
exports.__esModule = true;
var _leven = require("leven");
var _leven2 = _interopRequireDefault(_leven);
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;
router.run((Handler, routerState) => {
store.dispatch({
type: 'EVERYTHING_IS_AWESOME',
})
React.render(
<Provider store={store}>
{() => <Handler router={router} routerState={routerState}/>}
</Provider>, appElement);
});
@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

@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 / Await.js
Last active September 14, 2019 17:55
React WaitOn component
const Promise = require('bluebird');
const React = require('react');
const superagent = require('superagent');
const assign = require('lodash/object/assign');
const isArray = require('lodash/lang/isArray');
const isFunction = require('lodash/lang/isFunction');
const isObject = require('lodash/lang/isArray');
const isString = require('lodash/lang/isString');
const log = require('debug')('component:await');
@evanrs
evanrs / $event-scope.js
Last active August 29, 2015 14:06
Angular with granular Backbone style events.
ngModule.provider('$eventScope', function ($rootScopeProvider) {
var $get = $rootScopeProvider.$get.slice(-1)[0];
var $eventScope, proto, $cast, $emit;
this.$get = ['$injector', '$exceptionHandler', '$parse', '$browser',
function ($injector, $exceptionHandler, $parse, $browser) {
$eventScope = $eventScope || $get.apply($rootScopeProvider, arguments);
proto = proto || $eventScope.constructor.prototype;
$cast = $cast || proto.$broadcast;
$emit = $emit || proto.$emit;
@evanrs
evanrs / search-tree.js
Last active August 29, 2015 14:06
Thin Tree
var TT = require('./thin-tree');
var SearchTree = {
searchTree: function(query, op, source) {
op = op || 'where';
source = source || this.preOrderTraverse();
return _[op](source, query);
},
# SSL self signed localhost for rails start to finish, no red warnings.
# 1) Create your private key (any password will do, we remove it below)
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key