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 / gist:8809802
Created February 4, 2014 18:48 — forked from remy/gist:350433
if (typeof window.localStorage == 'undefined' || typeof window.sessionStorage == 'undefined') (function () {
var Storage = function (type) {
function createCookie(name, value, days) {
var date, expires;
if (days) {
date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
expires = "; expires="+date.toGMTString();
@evanrs
evanrs / todo.md
Created March 12, 2014 19:31
Prune old issues by pinging creators to resolve or close them.
@evanrs
evanrs / .gitconfig
Created March 17, 2014 19:03
git.deprecate — delete remote and local branches named by arguments
[alias]
deprecate = "!f(){ for ORIGIN in $@; do if [ $ORIGIN == master ] || [ $ORIGIN == HEAD ] || [ $ORIGIN == develop ]; then echo $ORIGIN is not allowed; continue;fi; echo $ORIGIN; git branch -d $ORIGIN; git push origin --delete $ORIGIN; done; }; f"
@evanrs
evanrs / factory.js
Created April 17, 2014 04:09
Angular Route Factory
var routeFactory = {
build: function(components, routes){
components = _.reduce(components, function (accumulator, component, index) {
if(_.isEmpty(accumulator)) return component
if(_.isString(accumulator)) accumulator = [accumulator]
var transform = accumulator.slice(0)
_.map(accumulator, function(route){
var slug = component
if(slug[0] === '/') slug = slug.slice(1)
else if(slug[0] === ':'){}
# 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
@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);
},
@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 / .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