Skip to content

Instantly share code, notes, and snippets.

View colemanfoley's full-sized avatar

Coleman Foley colemanfoley

View GitHub Profile
@colemanfoley
colemanfoley / README.md
Created March 27, 2013 23:03
The updated readme (from superbackup branch)

puckhead

###puckhead.nodejitsu.com

A two-player air hockey game where you move your mallet with your head!

###How to use:

  • Allow webcam usage in browser
@colemanfoley
colemanfoley / histogram.js
Created April 11, 2013 20:42
Histogram drawer
var testArray = [[0,3], [2,2], [1,1], [1,1]];
//This is the main function, which calls the helper functions.
var drawHistogram = function(array){
//These two steps prepare the inputs for the block that actually draws the histogram.
var combinedHeightsArray = combineHeights(array);
var orderedArray = orderAndFlattenArray(combinedHeightsArray);
//Drawing the histogram. The max height determines how many times drawLine is called.
//It draws the lines from the top down.
@colemanfoley
colemanfoley / findElements.js
Last active December 16, 2015 13:19
Solutions to a couple of interview questions.
/*
The main function for finding elements by CSS selector. It checks which type
of selector is being passed in, then either finds the elements right there or
calls a helper function to find the elements.
*/
var findElements = function (selector) {
if (selector[0] === ".") {
return document.getElementsByClassName(selector.slice(1));
}
else if (selector[0] === "#") {
@colemanfoley
colemanfoley / .block
Created July 15, 2018 19:29 — forked from mbostock/.block
Tidy Tree
license: gpl-3.0
border: no
height: 2000