Skip to content

Instantly share code, notes, and snippets.

View sobecreative's full-sized avatar
💭
Making moves

sobecreative

💭
Making moves
View GitHub Profile
var assert = require('assert');
/********************************
* We want make a package of goal kilos of chocolate. We have
* inventory of small bars (1 kilos each) and big bars (5 kilos each).
* Return the number of small bars to use, assuming we always
* use big bars before small bars. Return -1 if it can't be done.
*
* See the asserts below for examples of input
* and expected output.
var assert = require('assert');
/********************************
* Return true if the array contains, somewhere, three increasing
* adjacent numbers like .... 4, 5, 6, ... or 23, 24, 25.
*
* See the asserts below for examples of input
* and expected output.
*
* If you have node installed, all you need to do to test
@sobecreative
sobecreative / choropleth.js
Created November 5, 2012 19:37
d3 dropdown load json
var data; // loaded asynchronously
var path = d3.geo.path()
.projection(d3.geo.albersUsa()
.scale(1400)
.translate([680,360]));
var svg = d3.select("#chart").append("svg")
.attr("width", 1280)
.attr("height", 800);
@sobecreative
sobecreative / dojodiscover.html
Created September 21, 2012 19:32
Dojo discover OS, browser,
<!DOCTYPE html>
<html >
<head>
<script>dojoConfig = {async: true, parseOnLoad: false}</script>
<script src='dojo/dojo-release-1.8.0/dojo/dojo.js'></script>
<script>dojoConfig = {parseOnLoad: true}</script><script src='../_static/js/dojo/dojo.js'></script>
<script>
require(["dojo/has", // alias has API to "has"