Skip to content

Instantly share code, notes, and snippets.

@mbostock
mbostock / .block
Last active March 8, 2024 10:40
geo2svg
license: gpl-3.0
height: 1100
border: no
@mbostock
mbostock / .block
Last active January 10, 2024 01:25
World Tour
license: gpl-3.0
redirect: https://observablehq.com/@mbostock/world-tour
@mourner
mourner / TileLayer.Common.js
Created February 11, 2012 23:11
Leaflet shortcuts for common tile providers
// Lefalet shortcuts for common tile providers - is it worth adding such 1.5kb to Leaflet core?
L.TileLayer.Common = L.TileLayer.extend({
initialize: function (options) {
L.TileLayer.prototype.initialize.call(this, this.url, options);
}
});
(function () {
@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); });
@d3noob
d3noob / .block
Last active May 24, 2023 03:23
Collapsible tree diagram in v4
license: mit
@lobodin
lobodin / README.md
Last active March 30, 2023 06:23
Import GeoNames.org cities data to mongodb.

#Generate cities data

  1. wget http://download.geonames.org/export/dump/cities15000.zip
  2. unzip cities15000.zip
  3. node geonames.js cities15000.txt

The result is json array of cities in the following format:

{

_id:

@jeffcogswell
jeffcogswell / q_example.js
Last active August 12, 2022 01:22
Here's another chaining example on using q.js. This doesn't have any error handling, as I just want to demonstrate the chaining concept. Please read the comments carefully, as I start out with a non-q example, to show the order of flow. Please post comments if there's anything that isn't clear and I'll try to revise it as needed.
// Q sample by Jeff Cogswell
/*===========
We want to call these three functions in sequence, one after the other:
First we want to call one, which initiates an ajax call. Once that
ajax call is complete, we want to call two. Once two's ajax call is
complete, we want to call three.
BUT, we don't want to just call our three functions in sequence, as this quick
@mbostock
mbostock / .block
Last active August 11, 2022 21:42
U.S. States TopoJSON
license: gpl-3.0
height: 600
border: no
redirect: https://observablehq.com/@d3/u-s-map
@mbostock
mbostock / .block
Last active May 22, 2022 00:36
Every ColorBrewer Scale
license: gpl-3.0
redirect: https://observablehq.com/@d3/d3-color-schemes
@caged
caged / .gitignore
Last active February 26, 2022 23:33
US Federal Judicial Districts
.DS_Store
node_modules
us-judicial-districts.zip
build