Skip to content

Instantly share code, notes, and snippets.

@sdjacobs
sdjacobs / config.js
Created February 5, 2018 16:22
config.js for otp-vtrans-ui
window.OTP_config = {
initLatLng: [44.42, -72.01],
osmMapKey: 'your-mapbox-key',
aerialMapKey: 'your-mapbox-aerial-key',
// geocoderSearchRadius : 25, // search radius in km for mapzen geocoder from initLatLng (defaults to 50 if not specified)
// change to server where you are running OTP
otpApi: '/otp/routers/',
@sdjacobs
sdjacobs / .block
Last active January 12, 2019 21:48 — forked from mbostock/.block
World Tour
license: gpl-3.0
@sdjacobs
sdjacobs / # qgis - 2016-10-07_12-04-34.txt
Created October 7, 2016 17:02
qgis (homebrew/science/qgis) on macOS 10.10.5 - Homebrew build logs
Homebrew build logs for homebrew/science/qgis on macOS 10.10.5
Build date: 2016-10-07 12:04:34
@sdjacobs
sdjacobs / index.html
Last active September 12, 2016 17:00
number example
Pick a number <input type="number" pattern="\d*"/></input> <br>
Telephone number: <input type="tel"></input>
@sdjacobs
sdjacobs / index.html
Last active July 18, 2016 16:08
OTP client
<!DOCTYPE html>
<html>
<head>
<title>OTP</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css" />
</head>
@sdjacobs
sdjacobs / README.md
Last active April 18, 2017 15:20
Divvy Trips in Hyde Park

This visualization illustrates the use of a chord diagram. It's based on Mike Bostock's visualization of Uber data, and makes use of data made available by Divvy here.

This shows the origins and destinations of Divvy bikeshare trips in Hyde Park. The arcs represent origins and destinations, and the chords represent trips. Hover over the arcs to see what Divvy stations they represent. Hover over the chords to see magnitude in each direction.

4/18/2017 - the following links are dead

A larger version of this visualization is here.

I created this visualization as an example in my D3 workshop.

@sdjacobs
sdjacobs / index.html
Last active August 29, 2015 14:13 — forked from mbostock/.block
Finding the Key Players in a graph
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.node {
stroke: #fff;
stroke-width: 1.5px;
}
.link {
@sdjacobs
sdjacobs / d3.mapzoom.js
Last active August 29, 2015 14:13
Putting Dijkstra's algorithm on the map
d3.mapzoom = function() {
var center = [0,0]
var scale = 10000
var projection = undefined,
zoom = undefined,
tile = undefined
var layers = []
@sdjacobs
sdjacobs / cities.tsv
Last active March 2, 2019 02:14
Dijkstra's algorithm in Javascript/D3
We can make this file beautiful and searchable if this error is corrected: It looks like row 7 should actually have 29 columns, instead of 13. in line 6.
Cities1 Birmingham Boston Buffalo Chicago Cleveland Dallas Denver Detroit El Paso Houston Indianapolis Kansas City Los Angeles Louisville Memphis Miami Minneapolis New Orleans New York Omaha Philadelphia Phoenix Pittsburgh St. Louis Salt Lake City San Francisco Seattle Washington
Birmingham, Ala. 1194 947 657 734 653 1318 754 1278 692 492 703 2078 378 249 777 1067 347 983 907 894 1680 792 508 1805 2385 2612 751
Boston, Mass. 1194 457 983 639 1815 1991 702 2358 1886 940 1427 3036 996 1345 1539 1402 1541 213 1458 304 2664 597 1179 2425 3179 3043 440
Buffalo, N.Y. 947 457 536 192 1387 1561 252 1928 1532 510 997 2606 571 965 1445 955 1294 436 1011 383 2234 219 749 1978 2732 2596 386
Chicago, Ill. 657 983 536 344 931 1050 279 1439 1092 189 503 2112 305 546 1390 411 947 840 493 758 1729 457 293 1458 2212 2052 695
Cleveland, Ohio 734 639 192 344 1205 1369 175 1746 1358 318 815 2424 379 773 1325 763 1102 514 819 432 2052 131 567 1786 2540 2404 369
Dallas, Tex. 653 1815 1387 931 1205 801 1167 625 242 877 5
@sdjacobs
sdjacobs / get-french-unigrams.py
Created December 4, 2014 18:15
Get count of all French unigrams in the Google Books corpus
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from google_ngram_downloader import readline_google_store
all_records = readline_google_store(ngram_len=1, lang="fre")
this_ngram = "WORDS"
this_count = "COUNT"
for (fname, url, records) in all_records: