Skip to content

Instantly share code, notes, and snippets.


Chris Whong chriswhong

View GitHub Profile
chriswhong / getCurrentView.js
Last active Aug 29, 2015
Leaflet initial view helper
View getCurrentView.js
//Logs current map center and zoom level for use in map init options
//Use it to find that perfect intial view without having to use trial and error
function getInit() {
var c = map.getCenter();
console.log('center: [' + + ',' + c.lng + '],\nzoom: ' + map.getZoom());
chriswhong / cartocssmaker.js
Created May 27, 2015
Torque CartoCSS Maker
View cartocssmaker.js
//node script for generating complex cartoCSS for torque
//as value increases, duration of marker gets longer,
//radius gets larger, and color moves up the ramp.
var breaks = [0,10,50,100]
var colors = ['#eff3ff','#bdd7e7','#6baed6','#2171b5'];
var data = {
chriswhong / sql.txt
Created Jul 20, 2015
Gaussian Distribution for Dummy Data in CartoDB
View sql.txt
Given a table of census tracts, this query will generate a gaussian distribution of points offset from the tract's centroid.
Based on this example by Paul Ramsey:
WITH tracts AS (
SELECT *, random() AS u1, random() AS u2, 25 AS f, generate_series(1,total_pop/100) FROM chriswhong.nytracts
chriswhong / index.html
Last active Apr 12, 2020
D3 Sankey Link with Variable Width
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
<title>Variable Width Sankey Link</title>
path {
fill: steelblue;
View index.html
<!DOCTYPE html>
<html lang="en">
<head profile="">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="./favicon.ico">

##Real-Time Data in CartoDB texasGIS

About Chris: Solutions Engineer, Urbanist, Mapmaker, Open Data Junkie


chriswhong / .DS_Store
Last active May 29, 2019
Animated D3 Clock in Torque
chriswhong / index.html
Created Nov 13, 2015
Multiple CartoDB Named Maps on One Leaflet Map
View index.html
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<link rel="stylesheet" href="" />
#map, html, body {
chriswhong / alias.txt
Created Nov 19, 2015
Create an alias in the terminal to open the current directory in chrome via the local webserver
View alias.txt
alias chrome='/Applications/Google\\ Chrome --url "http://localhost/~chriswhong/$(basename $PWD)"'
You can’t perform that action at this time.