Skip to content

Instantly share code, notes, and snippets.

View dclowd9901's full-sized avatar

David Drew dclowd9901

  • Litchfield Park, AZ
View GitHub Profile
@dclowd9901
dclowd9901 / jshint-install.sh
Last active October 13, 2015 14:37
JSHintLI-install
#!/bin/sh
if ! type "node" > /dev/null; then
echo " "
echo "Node not installed. Please visit http://nodejs.org to download and install the correct Node package."
exit 1
else
echo " "
echo "Node installed correctly; continuing..."
fi
@dclowd9901
dclowd9901 / gist:4666044
Last active December 11, 2015 21:58
IdiomaticJS vs. IdiomaticJS @ Linkedin
Hey all,
During our meeting, Seth asked me what all the differences were between the vanilla IdiomaticJS standard and the LinkedIn idiomatic JS standard. I didn't feel I gave a very sufficient answer, so I decided to run the diff myself and cull out the JS@LinkedIn agreed-upon changes (plus, frankly, it's something I should just know):
1. args in parentheses will not internally wrap spacing:
for ( i in bar ) { ...
becomes
for (i in bar) { ...
if ( foo === bar ) { ...
@dclowd9901
dclowd9901 / dedupe.js
Last active December 21, 2015 17:49
Node.js script to dedupe a JSON-compliant array
/**
* Node script to dedupe an array in a file.
*
* Prereqs: lodash (globally)
*
* Use:
* > node dedupe.js path/to/file.js [path/to/newfile.js]
*/
var fs = require('fs'),
@dclowd9901
dclowd9901 / ManyFilesGrepper.js
Last active December 21, 2015 20:09
Accepts a js file containing a JSON-compliant array of filenames and looks through each file for comma-separated terms. The result is a list of files that contain references to the terms.
/**
*
* ManyFilesGrepper.js
* Accepts a js file containing a JSON-compliant array of
* filenames and looks through each file for comma-separated terms.
* The result is a list of files that contain references to
* the terms.
*
* Usage:
* >node ManyFilesGrepper.js path/to/list/of/files.js terms,to,match [path/to/file/to/write/to.js]
@dclowd9901
dclowd9901 / dial.js
Last active December 25, 2015 10:59
Phone numbers associated with words
var dial = { "2" : { "22" : { "222" : { "2222" : { "22222" : { "222222" : { "bacaba" : true }, "222223" : { "baccae" : true }, "222224" : { "2222243" : { "cabbage" : true }, "2222249" : { "cabbagy" : true }, "bacach" : true }, "222225" : { "caback" : true }, "222226" : { "cabaan" : true }, "222227" : { "2222272" : { "baccara" : true } }, "222228" : { "2222283" : { "abacate" : true, "baccate" : true } }, "222229" : { "abacay" : true, "abbacy" : true }, "abaca" : true, "bacca" : true }, "22223" : { "222233" : { "2222334" : { "Ababdeh" : true } }, "222237" : { "cabber" : true } }, "22224" : { "222242" : { "2222423" : { "Bacchae" : true }, "2222426" : { "Acacian" : true }, "2222427" : { "bacchar" : true }, "Acacia" : true }, "222243" : { "Babbie" : true }, "222244" : { "2222442" : { "Bacchic" : true, "bacchic" : true }, "2222444" : { "bacchii" : true }, "2222446" : { "acaciin" : true } }, "222246" : { "acacin" : true, "cabaho" : true }, "222247" : { "2222478" : { "abacist" : true } }, "222248" : { "2222487" : { "
ig.module('plugins.bezier.utils')
.requires(
'impact.impact'
)
.defines(function(){
BezierUtils = ig.Class.extend({
curvePixel: null,
@dclowd9901
dclowd9901 / gist:12f537692156b7799c0f
Created March 5, 2015 18:07
Generators without generators
function generator(func) {
var statefulArg;
return function() {
statefulArg = statefulArg || arguments[0];
statefulArg = func.apply(this, [statefulArg]);
return statefulArg
};
function duplicate(arr) {
return arr.concat(arr);
}
function add(a, b) {
return a + b;
}
function argToArray(args) {
var arr = [],
function asyncFunction(){
var deferred = Promise.defer();
setTimeout(function(){
console.log('ping');
deferred.resolve();
},3000);
return deferred.promise;
}
@dclowd9901
dclowd9901 / animated-route.js
Last active August 29, 2015 14:17
Ember AnimatedRoute
import Ember from 'ember';
import _ from 'lodash';
export default Ember.Route.extend({
lastTransition: null,
readyToTransition: false,
transitionend: 'transitionend oTransitionEnd webkitTransitionEnd',
animationend: 'animationend',