Skip to content

Instantly share code, notes, and snippets.

Chad Whitacre chadwhitacre

Block or report user

Report or block chadwhitacre

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:6723135
# Given this List of Songs, Construct Arrays by Artist and Album
# Hint: Make use of the split() String Method
# http://www.ruby-doc.org/core-1.9.3/String.html#method-i-split
# Simple Example of Data Parsing
songs = [
"The Magnetic Fields - 69 Love Songs - Parades Go By",
"The Magnetic Fields - Get Lost - Smoke and Mirrors",
"Neutral Milk Hotel - In An Aeroplane Over the Sea - Holland 1945",
"The Magnetic Fields - Get Lost - You, Me, and the Moon",
View async-context.js
var q = require('q'),
vm = require('vm'),
ctx = vm.createContext({setTimeout: setTimeout, console: console, end: q.defer()}),
script = vm.createScript("now = 1; setTimeout(function() { now = 2; console.log('Inside the VM: ' + now); end.resolve() }, 1000);");
script.runInContext(ctx);
ctx.end.promise.then(function () {
console.log("Now process template with " + ctx.now);
}, 500);
@chadwhitacre
chadwhitacre / gist:3783013
Created Sep 25, 2012
example that should(?) work but doesn't
View gist:3783013
class Counter(object):
visitors = 0
counter = Counter()
^L
counter.visitors += 1
^L
howdy, visitor number {{ visitors }} !
You can’t perform that action at this time.