Skip to content

Instantly share code, notes, and snippets.

@mbostock
mbostock / .block
Last active January 8, 2020 03:25 — forked from mbostock/.block
Equirectangular (Plate Carrée)
license: gpl-3.0
height: 480
redirect: https://beta.observablehq.com/@mbostock/d3-equirectangular
@mbostock
mbostock / .block
Last active October 20, 2023 14:09
General Update Pattern, I
license: gpl-3.0
redirect: https://observablehq.com/@d3/selection-join
@lbolla
lbolla / README.md
Created October 3, 2012 10:05
Asynchronous programming in Tornado

Asynchronous programming with Tornado

Asynchronous programming can be tricky for beginners, therefore I think it's useful to iron some basic concepts to avoid common pitfalls.

For an explanation about generic asynchronous programming, I recommend you one of the [many][2] [resources][3] [online][4].

I will focus on solely on asynchronous programming in [Tornado][1]. From Tornado's homepage:

@mbostock
mbostock / README.md
Last active June 7, 2023 18:33
Underscore’s Equivalents in D3

Collections

each(array)

Underscore example:

_.each([1, 2, 3], function(num) { alert(num); });
@mattsahr
mattsahr / require.main.js
Created December 2, 2012 18:04
requireJS Example
/*
* This is an example build file that demonstrates how to use the build system for
* require.js.
*
* copied from here: https://github.com/jrburke/r.js/blob/master/build/example.build.js
* THIS BUILD FILE WILL NOT WORK. It is referencing paths that probably
* do not exist on your machine. Just use it as a guide.
*
*
*/
@mbostock
mbostock / .block
Last active October 21, 2020 10:06 — forked from mbostock/.block
Delaunay Triangulation
license: gpl-3.0
@tmcw
tmcw / index.html
Created January 3, 2013 17:05
d3.keybinding
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
font:12px/20px 'Helvetica';
}
textarea, input {
width:100%;
height:20px;
margin:0;
@sxv
sxv / README.md
Last active July 3, 2018 07:20
Interactive SVG + Canvas Plot

A D3 demonstration of SVG and Canvas intermingling. Blue circles are plotted in SVG, black circles in canvas. One force to rule them all. The plot is zoomable and pannable.

Inspired by M. Bostock's Canvas / SVG zoom comparison series and collision detection examples [1] [2] .

@alexjohnj
alexjohnj / _deploy.py
Last active March 27, 2021 01:44
A deployment script I use to push my Jekyll blog onto Amazon S3. It compiles sass files, generates the site, gzips HTML, CSS & JavaScript and then uploads the site to Amazon S3 using s3cmd.
#! /usr/local/bin/python3
""" Requirements: s3cmd, jekyll, gzip & sass.
Mk 2 of the script
To use this script, you'll need to edit your site's _config.yml file and add the following:
s3bucket: s3://bucket-name
Remember: Change the path_to_sass_file & sass_compile_path variables if you want to compile sass files. If you don't want to compile sass files, comment out the call to the compile_sass() function.
@caged
caged / svg-to-png.js
Created January 27, 2013 18:11
Convert SVG's to PNGs. This works OK if the SVG's styles are inline. The SVG element must contain an xmlns attribute. Webkit also requires you specify a font size on `text` elements.
var svg = document.getElementById('graph'),
xml = new XMLSerializer().serializeToString(svg),
data = "data:image/svg+xml;base64," + btoa(xml),
img = new Image()
img.setAttribute('src', data)
document.body.appendChild(img)