Skip to content

Instantly share code, notes, and snippets.

View wulymammoth's full-sized avatar
processing unit

David W wulymammoth

processing unit
View GitHub Profile
@wulymammoth
wulymammoth / ScriptInjection.js
Created February 3, 2017 02:28 — forked from ThomasBurleson/ScriptInjection.js
Script injection with Deferred/Promises (non-jQuery)
/**
* Module that implements non-jQuery script injection with Deferred/Promise support (using
* Q.js ).
*
* This deferred load notifies caller when the script is loaded... so chaining
* or post load actions is easily supported.
*
*/
( function( win, doc, $q ){
"use strict";
@wulymammoth
wulymammoth / railway_programming_in_elixir.md
Last active February 16, 2020 09:50
Railway Programming in Elixir
find . -d -name node_modules | while read line; do rm -rf $line; done
@wulymammoth
wulymammoth / gist:8d6124f9462554e34958da79161e7539
Created November 14, 2016 23:41 — forked from lopopolo/gist:9427762
Relink all homebrew formulae after Mavericks upgrade
▶ brew list -1 | while read line; do brew unlink $line; brew link $line; done
Unlinking /usr/local/Cellar/appledoc/2.2... 0 links removed
Linking /usr/local/Cellar/appledoc/2.2... 1 symlinks created
Unlinking /usr/local/Cellar/autoconf/2.69... 0 links removed
Linking /usr/local/Cellar/autoconf/2.69... 18 symlinks created
Unlinking /usr/local/Cellar/bash-completion/1.3... 184 links removed
Linking /usr/local/Cellar/bash-completion/1.3... 182 symlinks created
Unlinking /usr/local/Cellar/bgrep/0.2... 0 links removed
Linking /usr/local/Cellar/bgrep/0.2... 1 symlinks created
Unlinking /usr/local/Cellar/binutils/2.24... 49 links removed
@wulymammoth
wulymammoth / MVC.js
Last active January 15, 2019 21:20
/* MVC */
// MODEL
function ModelBase(attributes) {
for (var attr in attributes) {
this[attr] = attributes[attr];
}
this._eventHandlers = {};
}
// using native JS
function filter(list, predicate) {
list.reduce(function(prev, curr, i, arr) {
if (!predicate(curr)) arr.splice(i, 1);
}, []);
return list;
}
// using Underscore
@wulymammoth
wulymammoth / genius-bookmarklet.js
Created April 9, 2015 20:05
Annotate the world with this Genius Bookmarklet (Chrome)
// 1. Right-click on the bookmarks toolbar
// 2. Click Add Page...
// 3. Name: <enter whatever you'd like> (Mine is Genius Annotate)
// 4. Paste the following into the URL field (including the keyword javascript and the colon):
javascript: window.location.replace('http://genius.it/' + window.location.href)
@wulymammoth
wulymammoth / angularjs-isolate-scope-bindings.html
Last active August 29, 2015 14:05
How to utilize Isolate Scope Bindings in AngularJS
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<meta name="AngularJS Isolate Scope Bindings" content="Binding to Isolate Scope" />
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.14/angular.min.js"></script>
<meta charset="utf-8">
<title>AngularJS Isolate Scope Bindings</title>
</head>
<body ng-controller="MainCtrl as main">
@wulymammoth
wulymammoth / singleton.js
Created August 13, 2014 03:14
Singleton Constructor
var MakeSingleton = function(){
var obj;
return function() {
if( obj ){
return obj;
} else{
obj = this;
}
};
};
@wulymammoth
wulymammoth / functionalJS.js
Created August 11, 2014 22:27
From Imperative to Functional JS
/**
* Write a simple join function in the various styles:
* 1. Imperative
* 2. Object-oriented
* 3. Functional language
*/
// Imperative
function simpleJoin( stringArray ) {
var accumulator = '';