This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"keys": [], "values": ["123"]} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
voices = %w[Agnes Alex Bruce Bubbles Fred Junior Kathy Princess Ralph Vicki Victoria] | |
phrases = [ | |
"We are the Borg.", | |
"Lower your shields and surrender your ships.", | |
"We will add your biological and technological distinctiveness to our own.", | |
"Your culture will adapt to service us.", | |
"Resistance is futile." | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getter(attr, scale) { | |
return function(d) { | |
return scale ? scale(d[attr]) : d[attr] | |
} | |
} | |
var defaults = { | |
width: 560, | |
height: 250, | |
x: 'x', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Challenge #1 | |
* | |
* Color: represents an RGB color. Pass a hexadecimal string (RRGGBB format, | |
* like CSS) to this constructor and get a Color object with integer r, g, and b | |
* components | |
*/ | |
function Color(rgb) { | |
if (!(this instanceof Color)) return new Color(rgb); | |
var parts = rgb.match(/([0-9a-f]{2})/gi); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var pouch = require('pouchdb'); | |
var pouches = { | |
http1: 'http://localhost:5984/http1', | |
http2: 'http://localhost:5984/http2', | |
ldb1: 'ldb://testdb1', | |
ldb2: 'ldb://testdb2', | |
} | |
Object.keys(pouches).forEach(function(key) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var path = require('path') | |
var Pouch = require('pouchdb') | |
var async = require('async') | |
var request = require('request') | |
var queue = async.queue(queueWorker, 5) // 5 requests at a time | |
var imageURLs = [ | |
"http://substack.net/images/ben.png", | |
"http://substack.net/images/bed.png" | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs') | |
, path = require('path') | |
function rmdir(dir, callback) { | |
fs.readdir(dir, function rmfiles(err, files) { | |
if (err && err.code == 'ENOTDIR') { | |
return fs.unlink(dir, callback); | |
} | |
else if (err) { | |
return callback(err); |