Skip to content

Instantly share code, notes, and snippets.

View tomshanley's full-sized avatar

Tom Shanley tomshanley

View GitHub Profile
@tomshanley
tomshanley / d3.min.js
Last active August 29, 2015 14:06
Treemap websites
d3=function(){function n(n){return null!=n&&!isNaN(n)}function t(n){return n.length}function e(n){for(var t=1;n*t%1;)t*=10;return t}function r(n,t){try{for(var e in t)Object.defineProperty(n.prototype,e,{value:t[e],enumerable:!1})}catch(r){n.prototype=t}}function u(){}function i(){}function o(n,t,e){return function(){var r=e.apply(t,arguments);return r===t?n:r}}function a(n,t){if(t in n)return t;t=t.charAt(0).toUpperCase()+t.substring(1);for(var e=0,r=Do.length;r>e;++e){var u=Do[e]+t;if(u in n)return u}}function c(){}function l(){}function s(n){function t(){for(var t,r=e,u=-1,i=r.length;++u<i;)(t=r[u].on)&&t.apply(this,arguments);return n}var e=[],r=new u;return t.on=function(t,u){var i,o=r.get(t);return arguments.length<2?o&&o.on:(o&&(o.on=null,e=e.slice(0,i=e.indexOf(o)).concat(e.slice(i+1)),r.remove(t)),u&&e.push(r.set(t,{on:u})),n)},t}function f(){mo.event.preventDefault()}function h(){for(var n,t=mo.event;n=t.sourceEvent;)t=n;return t}function g(n){for(var t=new l,e=0,r=arguments.length;++e<r;)t[argument
@tomshanley
tomshanley / govtwebsites.csv
Last active August 29, 2015 14:09
Treemap Websites 2
We can make this file beautiful and searchable if this error is corrected: It looks like row 9 should actually have 20 columns, instead of 10. in line 8.
Agency,website,size,Births-deaths-marriages,Citizenship-and-immigration,Community-arts-and-sport,Consumer-rights,Crime-law-and-justice,Driving-and-transport,Education-and-training,Emergencies-and-disasters,Environment-and-climate,Health,History-culture-and-heritage,Housing-and-property,Internet-media-and-communication,Money-benefits-and-tax,Parliament-and-politics,Passports-travel-and-tourism,Work-and-jobs
Department of Internal Affairs,archives.govt.nz,1168,,,X,,,,,,,,X,,,,,,
Department of Internal Affairs,archway.archives.govt.nz,1062,,,,,,,,,,,,,,,X,,
Department of Internal Affairs,audiovisual.archives.govt.nz,1034,,,,,,,,,,,X,,,,,,
Department of Internal Affairs,beta.natlib.govt.nz,1001,,,,,,,,,,,,,,,,,
Department of Internal Affairs,canterbury-hearings.royalcommission.govt.nz,1011,,,,,,,,X,,,,,,,,,
Department of Internal Affairs,cartoons.org.nz,1000,,,X,,,,,,,,X,,,,,,
Department of Internal Affairs,cdgo.govt.nz,1066,,,,,,,,,,,,,,,,,
Department of Internal Affairs,christchurch.archives.govt.nz,1001,,,,,,,
@tomshanley
tomshanley / barchart.tsv
Last active August 29, 2015 14:09
Sortable bar chart
letter frequency
A .08167
B .01492
C .02780
D .04253
E .12702
F .02288
G .02022
H .06094
I .06973
@tomshanley
tomshanley / index.html
Last active August 29, 2015 14:09
Gestalt principles demo
<!DOCTYPE html>
<html>
<head>
<title>Gestalt Theory</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
@tomshanley
tomshanley / index.html
Last active August 29, 2015 14:09
Cleveland and McGill Elementary Perceptual Tasks
<!DOCTYPE html>
<html>
<head>
<title>Cleveland and McGill</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
@tomshanley
tomshanley / index.html
Last active August 29, 2015 14:09
Perception of Movement
<!DOCTYPE html>
<html>
<head>
<title>Movement</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link type="text/css" rel="stylesheet" href="css/style.css">
</head>
<body>
@tomshanley
tomshanley / index.html
Last active August 29, 2015 14:09
Brush scatterplot, three by one matrix
<!DOCTYPE html>
<meta charset="utf-8">
<title>Trees</title>
<style>
svg {
font: 10px sans-serif;
padding: 10px;
}
@tomshanley
tomshanley / readme.md
Last active August 29, 2015 14:09
Recommended reading for BA Dev Day 2014
@tomshanley
tomshanley / .block
Last active August 10, 2017 03:19
Sankey with highlighting and CSV import
license: mit
@tomshanley
tomshanley / ShortestPathCalculator.js
Last active May 2, 2019 08:32
Force directed graph using tabletop.js and shortestpath
/*
*
* Dijkstra Short Path Calculator and Graph Plotter
* Uses D3 JS (V3)
*
*/
var ShortestPathCalculator = function(nodes, paths) {
this.nodes = nodes; // nodes => [ { index: 0, value: 'a', r: 20 }, ... ]