Skip to content

Instantly share code, notes, and snippets.

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

Evan Schneider evanrs

🏋️‍♂️
Focusing
View GitHub Profile
<script type="text/ng-template" id="one.html">
<div>This is first template</div>
</script>
<script type="text/ng-template" id="two.html">
<div>This is second template</div>
</script>
@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 / 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');