Skip to content

Instantly share code, notes, and snippets.

View messerc's full-sized avatar

Chris Messer messerc

View GitHub Profile
'use strict';
/* Implement the function asyncMap:
*
* asyncMap has two parameters, an array of asynchronous functions (tasks) and a callback.
* Each of the tasks takes a separate callback and invokes that callback when complete.
*
* The callback passed to asyncMap is then performed on the results of the callbacks of the tasks.
*
* The order of these results should be the same as the order of the tasks.
/*
* Return an array with the power set of a given string.
* Definition of power set: The set of all possible subsets including the empty set.
*
* Example:
*
* powerSet("abc")
* -> [ '' , 'a', 'b', 'c', 'ab', 'ac', 'bc', 'abc' ]
*
* Note:
/**
* Write a function that, given two objects, returns whether or not the two
* are deeply equivalent--meaning the structure of the two objects is the
* same, and so is the structure of each of their corresponding descendants.
*
* Examples:
*
* deepEquals({a:1, b: {c:3}},{a:1, b: {c:3}}); // true
* deepEquals({a:1, b: {c:5}},{a:1, b: {c:6}}); // false
*
/* Write a function that finds the largest possible product of any three numbers
* from an array.
*
* Example:
* largestProductOfThree([2, 1, 3, 7]) === 42
*
* Extra credit: Make your function handle negative numbers.
*/
// Create a convenience function that sorts arrays ascending numerically
// if numRows is > 2: initialize an array that will hold our pascals triangle with [[1], [1, 1]]
// generate a loop based on the numRows input and start at i = 2 and initialize a new row
// inside each iteration, produce an inner loop of j that will help produce the current row
// reach into our pascals triangle array, sum up the appropriate values, and push to our row
// finish by pushing a final 1 to the current row and then pushing that row to our pascals triangle array
// return our pascals array
var generate = function(numRows) {
if (numRows === 0) {
@messerc
messerc / index.html
Created November 18, 2016 03:09
Brush n' Zewm
<!DOCTYPE html>
<html>
<style type="text/css">
.area {
fill: rgb(51, 153, 204);
clip-path: url(#clip);
}
.zoom {
@messerc
messerc / d3fun.css
Last active November 17, 2016 04:08
Vertical Bar Chart
.bar {
fill: rgb(51, 153, 204);
}
.bar:hover {
fill: rgb(65, 179, 224);
}