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 / base64.js
Created July 27, 2010 12:28
Base64.js
function encode(s) {
var c = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
o = [];
for (var i = 0, n = s.length; i < n;) {
var c1 = s.charCodeAt(i++),
c2 = s.charCodeAt(i++),
c3 = s.charCodeAt(i++);
o.push(c.charAt(c1 >> 2));
o.push(c.charAt(((c1 & 3) << 4) | (c2 >> 4)));
o.push(c.charAt(i < n + 2 ? ((c2 & 15) << 2) | (c3 >> 6) : 64));
@mbostock
mbostock / perlin-worker.js
Created August 20, 2010 04:19
Polymaps / Procedural Perlin
onmessage = function(e) {
var data = e.data.data = [],
n = Math.pow(2, 7 - e.data.zoom),
x0 = e.data.column * n,
y0 = e.data.row * n,
w = e.data.size.x,
h = e.data.size.y;
for (var y = 0, i = 0; y < h; y++) {
for (var x = 0; x < w; x++) {
@mbostock
mbostock / app.yaml
Created August 26, 2010 05:05
polymaps.appspot.com
application: polymaps
version: 1
runtime: python
api_version: 1
handlers:
- url: /state/.*
script: main.py
- url: /county/.*
@mbostock
mbostock / jsonp.diff
Created August 31, 2010 05:32
Polymaps / JSONP Queue
diff --git a/src/Queue.js b/src/Queue.js
index d243c13..616dbc6 100644
--- a/src/Queue.js
+++ b/src/Queue.js
@@ -99,5 +99,41 @@ po.queue = (function() {
return {abort: abort};
}
- return {text: text, xml: xml, json: json, image: image};
+ function jsonp(src, callback) {
@mbostock
mbostock / .block
Last active June 16, 2016 01:34
Hello, bl.ocks.org!
license: gpl-3.0
@mbostock
mbostock / .block
Last active December 6, 2016 11:39
Streamgraph
license: gpl-3.0
@mbostock
mbostock / .block
Last active February 8, 2016 22:54
Pale Dawn
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 / .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