Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / 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 / 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 / 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
You can’t perform that action at this time.