Skip to content

Instantly share code, notes, and snippets.

@standarderror
standarderror / 0_reuse_code.js
Created Aug 31, 2014
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@standarderror
standarderror / README.md
Last active Jul 7, 2016
D3.js network of murders in The Wire
View README.md

A force-directed graph of murders in TV show The Wire, discussed at blog subsubroutine.com. Created with D3.js.

Credits:

@standarderror
standarderror / randomGraph
Last active Aug 29, 2015
Random Graph D3
View randomGraph
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
// # groups added by Cam
function erdosRenyi(nodesNum,directedness,prob,groups) {
// create nodes list
var nodes = []
@standarderror
standarderror / dewey.js
Last active Aug 29, 2015
Dewey Decimal tree explorer
View dewey.js
var margin = {top: 20, right: 120, bottom: 20, left: 120},
width = 960 - margin.right - margin.left,
height = 600 - margin.top - margin.bottom;
var i = 0,
duration = 750,
root ;
var tree = d3.layout.tree()
.size([height, width]);
@standarderror
standarderror / index.html
Last active Aug 29, 2015
20141222 Dewey Decimal sunburst
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
<title>DDC sunburst</title>
<style>
#chart2 {
/* centre SVG horizontally */
/* position: relative;
left: 50%;
margin-left: -400px; */
@standarderror
standarderror / index.html
Last active Feb 24, 2019
20141222 Dewey Decimal treemap
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
<title>DDC zoomable treemap</title>
<style>
#chart1 {
width: 960px;
height: 500px;
background: #ddd;
/* centre SVG horizontally */
@standarderror
standarderror / extract films by year.py
Last active Aug 29, 2015
20150106 Western films as swaying grass
View extract films by year.py
import re
from collections import Counter
%pylab inline
yeararray = []
infile = "/Users/Cam/Downloads/imdb/genres.list"
with open(infile) as f: # using with open will automatically close file
for line in f:
@standarderror
standarderror / d3.min.js
Last active Aug 29, 2015
20150107 Movies by genre history
View d3.min.js
!function(){function n(n,t){return t>n?-1:n>t?1:n>=t?0:0/0}function t(n){return null===n?0/0:+n}function e(n){return!isNaN(n)}function r(n){return{left:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n(t[i],e)<0?r=i+1:u=i}return r},right:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n(t[i],e)>0?u=i:r=i+1}return r}}}function u(n){return n.length}function i(n){for(var t=1;n*t%1;)t*=10;return t}function o(n,t){for(var e in t)Object.defineProperty(n.prototype,e,{value:t[e],enumerable:!1})}function a(){this._=Object.create(null)}function c(n){return(n+="")===da||n[0]===ma?ma+n:n}function l(n){return(n+="")[0]===ma?n.slice(1):n}function s(n){return c(n)in this._}function f(n){return(n=c(n))in this._&&delete this._[n]}function h(){var n=[];for(var t in this._)n.push(l(t));return n}function g(){var n=0;for(var t in this._)++n;return n}function p(){for(var n in this._)return!1;return!0}function v(){this._=Object
@standarderror
standarderror / index.html
Last active Feb 17, 2016
20150111 Regression Scatterplot Animation
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
<style>
#chart {
}
.circle {
stroke: '#fff';
@standarderror
standarderror / index.html
Created Jan 12, 2015
20150115 Regression Animation in Viewbox
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
<style>
#chart {
/* margin-left:50%; */
}
.circle {
stroke: '#fff';
You can’t perform that action at this time.