Skip to content

Instantly share code, notes, and snippets.

View danieluhl's full-sized avatar

Typing Turtle danieluhl

View GitHub Profile
@danieluhl
danieluhl / walk_graph.js
Created December 23, 2015 21:17
Walk a graph from leaf to root and build results based on a child/parent relationship
tree = {
a: ['b', 'c', 'd'],
b: ['e', 'f'],
c: ['g', 'h'],
h: ['i', 'j', 'k'],
k: ['l'],
l: ['m', 'n']
}
var _ = require('underscore');
@danieluhl
danieluhl / grunt_tests.js
Last active December 2, 2015 19:37
An example of how to run node commands from grunt and get the output result
'use strict';
module.exports = function(grunt) {
grunt.registerTask('runTests', '', function() {
var done = this.async();
grunt.util.spawn({
cmd: 'node',
args: ['./js/tests/runner/tests.js']
}, function(e, result) {
/*
TrafficCop
Author: Jim Cowart
License: Dual licensed MIT (http://www.opensource.org/licenses/mit-license) & GPL (http://www.opensource.org/licenses/gpl-license)
Version 0.1.0
*/
(function($, undefined) {
var inProgress = {};
@danieluhl
danieluhl / js namespace
Created March 8, 2012 21:49
JavaScript Namespace
(function (libraryNamespace, $, undefined) {
// private properties
var privateProperty = 'default private';
// public properties
libraryNamespace.publicProperty = 'default public';
// private methods
function updatePublicProperty(newPublic) {
this.publicProperty = newPublic || 'new public';