Skip to content

Instantly share code, notes, and snippets.

View mbostock's full-sized avatar
📊
Plottin’

Mike Bostock mbostock

📊
Plottin’
View GitHub Profile
@mbostock
mbostock / type.js
Created December 11, 2012 17:59
GeoJSON Transforms
function d3_geo_type(types) {
for (var type in d3_geo_typeDefaults) {
if (!(type in types)) {
types[type] = d3_geo_typeDefaults[type];
}
}
return types;
}
var d3_geo_typeDefaults = {
@mbostock
mbostock / index.js
Last active October 31, 2015 00:51
D3 Bookmarklet
javascript:var f = document.createElement("script");f.setAttribute("src", "//d3js.org/d3.v3.min.js");document.head.appendChild(f);
@mbostock
mbostock / finite-state-stream.js
Created December 19, 2012 01:12
Finite State Stream
function d3_geo_pathContext(context) {
var pointRadius = 4.5,
state = 0;
// state bit 0: not-first point?
// state bit 1: inside line?
// state bit 2: inside polygon?
function point(x, y) {
if (state) {
@mbostock
mbostock / .gitignore
Last active December 25, 2015 18:38
New Splines!
.DS_Store
node_modules
@mbostock
mbostock / graphicsmagick-examples.sh
Last active February 2, 2016 01:21
GraphicsMagick Cheat Sheet
#!/bin/bash
# Making a non-square image square by adding padding.
gm montage -geometry 1024x1024 -background none source.png target.png
@mbostock
mbostock / .block
Last active February 8, 2016 22:54
Pale Dawn
license: gpl-3.0
@mbostock
mbostock / .block
Last active February 8, 2016 22:57
CSS3 Modal Button
license: gpl-3.0
@mbostock
mbostock / .block
Last active February 8, 2016 22:59
Minecraft Overviewer
license: gpl-3.0
@mbostock
mbostock / .block
Last active February 8, 2016 23:00
Cellular automata
license: gpl-3.0
redirect: https://beta.observablehq.com/@mbostock/1d-cellular-automaton
@mbostock
mbostock / README.md
Last active February 8, 2016 23:03
Loupe

This example is a simple loupe using Polymaps. Drag the center of the loupe to move it around, or drag the thick border to resize it. Loupes are normally used to magnify, showing focus and context, but in this example we're using it to show two different tilesets. You can enable magnification (or minification) using the zoomDelta property.