Skip to content

Instantly share code, notes, and snippets.

View caged's full-sized avatar
🎸

Justin Palmer caged

🎸
View GitHub Profile
Friday 12:33am 02/04/2011
Friday 12:49am 02/04/2011
Saturday 04:35am 02/05/2011
Tuesday 04:41am 02/08/2011
Saturday 12:12am 02/12/2011
Monday 10:41am 02/14/2011
Monday 10:41am 02/14/2011
Wednesday 11:11am 02/16/2011
Wednesday 03:42pm 02/16/2011
Wednesday 04:41pm 02/16/2011
w = 800
h = 800
r = Math.min(w, h) / 2
donut = d3.layout.pie()
arc = d3.svg.arc()
.innerRadius(r * 0.95)
.outerRadius(r)
vis = d3.select('#chart')
.append('svg:svg')
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="https://github.com/Caged/d3/raw/master/d3.js"></script>
<style type="text/css">
html, body {
width: 100%;
height: 100%;
margin: 0;
@caged
caged / index.html
Created April 24, 2011 22:46 — forked from mbostock/.block
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="https://github.com/Caged/d3/raw/master/d3.js"></script>
<style type="text/css">
html, body {
width: 100%;
height: 100%;
margin: 0;
{ "type": "Feature", "properties": { "RTE": 6, "DIR": 0, "RTE_DESC": "Martin Luther King Jr Blvd", "PUBLIC_RTE": "6", "DIR_DESC": "To Jantzen Beach", "FREQUENT": "True", "TYPE": "BUS" }, "geometry": { "type": "LineString", "coordinates": [ [ -122.692970, 45.517621 ], [ -122.692947, 45.517598 ], [ -122.692876, 45.517561 ], [ -122.692545, 45.517496 ], [ -122.691598, 45.517231 ], [ -122.690613, 45.516967 ], [ -122.690611, 45.516967 ], [ -122.688716, 45.516457 ], [ -122.688570, 45.516425 ], [ -122.688388, 45.516370 ], [ -122.688211, 45.516324 ], [ -122.688081, 45.516289 ], [ -122.687856, 45.516230 ], [ -122.687746, 45.516199 ], [ -122.687635, 45.516171 ], [ -122.686756, 45.515936 ], [ -122.686610, 45.515897 ], [ -122.685593, 45.515625 ], [ -122.684710, 45.515388 ], [ -122.684571, 45.515351 ], [ -122.683574, 45.515082 ], [ -122.683203, 45.514981 ], [ -122.683065, 45.514943 ], [ -122.682087, 45.514682 ], [ -122.681070, 45.514413 ], [ -122.680049, 45.514142 ], [ -122.679516, 45.513999 ], [ -122.679027, 45.513868 ],
# get the name of the branch we are on
git_prompt_info() {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo "[${ref#refs/heads/}]"
}
autoload -U colors
colors
setopt prompt_subst
PROMPT='%{$fg[green]%}%n@%m %c%{$fg[red]%}$(git_prompt_info)%{$fg[green]%}%% %{$reset_color%}'
/* line 47, icons */
.icons-sprite, .icons-overview, .icons-demographics {
background: url('/assets/icons-s5c51818f71.png') no-repeat;
}
/* line 110, /Users/justin/dev/lrr/rails/local_blade/app/assets/stylesheets/application.css.sass */
.icons-overview {
background-position: 20px -70px;
}
/* line 43, /Users/justin/.rvm/gems/ruby-1.9.2-p180@rails3.1/bundler/gems/compass-2124003550bf/frameworks/compass/stylesheets/compass/utilities/sprites/_base.scss */
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?1.25.0"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js?1.25.0"></script>
</head>
<body>
<script type="text/javascript">
var w = 400,
@caged
caged / gist:1172470
Created August 26, 2011 01:25
census block heatmap
$.getJSON '/data/mn-blks.json', (data) ->
values = _.uniq(_.map(data.features, (d) -> d.counts[prop]))
color = d3.scale.quantile()
.domain(values)
.range(d3.range(4))
# Add and clasify block-level geography
map.add po.geoJson()
.features(data.features)
.on 'load', (d) ->
_.each(d.features, (f) ->
@caged
caged / gist:1173725
Created August 26, 2011 15:50
d3.js experiment - Donuts, Bars and Crime.
#
# CoffeeScript for http://dealloc.me/demos/crime/2011.html
# Copyright (c) 2011 Justin Palmer <http://github.com/Caged>
# LICENSE: http://www.opensource.org/licenses/mit-license.php
$ ->
hash = document.location.hash
year = if hash then hash.replace('#', '') else 2011
[pt,pl,pb,pr] = [35, 20, 20, 20]
w = (900 - (pl + pr)) / 2
h = w