Skip to content

Instantly share code, notes, and snippets.

@sethblanchard
sethblanchard / keybase.md
Created August 8, 2018 20:25
keybase.md

Keybase proof

I hereby claim:

To claim this, I am signing this object:

[{"anger":[{"timestamp":12396.243000002869,"value":0.017879068851470947},{"timestamp":12546.30900000484,"value":0.01998201757669449},{"timestamp":12729.723000004014,"value":0.002832104219123721},{"timestamp":12779.74499999982,"value":0.0025018546730279922},{"timestamp":12829.767000002903,"value":0.0021786449942737818},{"timestamp":12879.789000005985,"value":0.0026767903473228216},{"timestamp":12929.811000001791,"value":0.0068109482526779175},{"timestamp":12979.833000004874,"value":0.002155900001525879},{"timestamp":13029.85500000068,"value":0.0020600836724042892},{"timestamp":13079.877000003762,"value":0.002028809394687414},{"timestamp":13129.898999999568,"value":0.002040538936853409},{"timestamp":13179.92100000265,"value":0.00252713356167078},{"timestamp":13229.943000005733,"value":0.0023436446208506823},{"timestamp":13279.965000001539,"value":0.002009635791182518},{"timestamp":13363.335000001825,"value":0.0021777956280857325},{"timestamp":13413.357000004908,"value":0.0021448649931699038},{"timestamp":13463.
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame']
|| window[vendors[x]+'CancelRequestAnimationFrame'];
}
if (!window.requestAnimationFrame)
@sethblanchard
sethblanchard / sample_replace.js
Last active November 29, 2015 02:38
Node Replace
var mongo = require('mongoskin');
var db = mongo.db("mongodb://localhost/learnmongo");
db.bind('sample');
var test1 = {
first: 'Jane',
last: 'Doe',
sex: 'female'
}
@sethblanchard
sethblanchard / readFilesThenDoSomething.js
Created July 9, 2015 13:05
Read in several files and once they are all in memory do something with them
var fs = require('fs');
var data_dir = '/data/',
read_dir = __dirname + data_dir;
var readFilesThenDoSomething = function(files, callback){
var completed_files = []; //could error check here
files.map(function(file_name){
@sethblanchard
sethblanchard / rafDebounce.js
Created June 25, 2015 18:01
Initial idea for debounce with request animation frame
_ticking = false;
function onResize() {
requestTick();
}
/**
* Calls rAF if it's not already
* been done already
*/
@sethblanchard
sethblanchard / .gistup
Created March 7, 2014 20:26
Tax Scatter start
gistup
//Practically all this code comes from https://github.com/alangrafu/radar-chart-d3
//I only made some additions and aesthetic adjustments to make the chart look better
//(of course, that is only my point of view)
//Such as a better placement of the titles at each line end,
//adding numbers that reflect what each circular level stands for
//Not placing the last level and slight differences in color
//
//For a bit of extra information check the blog about it:
//http://nbremer.blogspot.nl/2013/09/making-d3-radar-chart-look-bit-better.html
@sethblanchard
sethblanchard / data.tsv
Created December 13, 2012 15:30 — forked from mbostock/.block
D3 line chart example used as base. Updating for my purposes
date close
1-May-12 582.13
30-Apr-12 583.98
27-Apr-12 603.00
26-Apr-12 607.70
25-Apr-12 610.00
24-Apr-12 560.28
23-Apr-12 571.70
20-Apr-12 572.98
19-Apr-12 587.44
@sethblanchard
sethblanchard / drawLine.js
Created September 13, 2011 19:53
d3 Multiple Line Try
var w = 800,
h = 600,
color = d3.scale.category20c(),
x = d3.scale.linear().domain([0, 10]).range([0, w]),
y = d3.scale.ordinal().domain(d3.range(lineData.length)).rangeBands([0, h], .4);
var viz = d3.select("#chart").append("svg:svg")
.attr("width", w)
.attr("height", h);