Skip to content

Instantly share code, notes, and snippets.

View jczaplew's full-sized avatar

John J Czaplewski jczaplew

View GitHub Profile
@jczaplew
jczaplew / cancelable.js
Created June 4, 2018 20:21
Cancelable async
class Cancelable {
constructor() {
this.canceled = false
}
count(val) {
return new Promise((resolve, reject) => {
setTimeout(function() {
resolve(val*val)
}, 1000)
@jczaplew
jczaplew / test.sql
Created December 14, 2017 22:06
PostGIS Multipolygon Join
This file has been truncated, but you can view the full file.
--
-- PostgreSQL database dump
--
-- Dumped from database version 9.6.4
-- Dumped by pg_dump version 9.6.4
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
@jczaplew
jczaplew / setup.sh
Created January 25, 2017 23:51
Install mapnik 3.+ on Ubuntu 14.04 Trusty
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install git
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update && sudo apt-get install gcc-4.9 g++-4.9
rm /usr/bin/g++ && sudo ln -s /usr/bin/g++-4.9 /usr/bin/g++
wget http://www.freedesktop.org/software/harfbuzz/release/harfbuzz-0.9.34.tar.bz2
@jczaplew
jczaplew / README.md
Last active September 14, 2017 23:21
Responsive TopoJSON Sizing with d3.js

States will adjust in size relative to the width of the container div, which allows SVG elements to be appropriately sized regardless of device size or screen resolution, making it a good way to integrate D3 and Bootstrap.

Click "Open in a new window", change the size of your browser window, and the states will scale with it. *Will not work in the standard bl.ocks.org view

Please let me know if there is a better/native way to do this!

@jczaplew
jczaplew / import.sh
Created November 26, 2013 00:08
Bulk import SHP into PostGIS
#! I need this for my broken version of Postgres.app
#!export DYLD_LIBRARY_PATH=/Applications/Postgres.app/Contents/MacOS/lib/
for i in *.shp; do
shp2pgsql -s 4326 $i | psql -h localhost -U you -d database
done
@jczaplew
jczaplew / README.md
Last active February 17, 2017 05:20
Lazy composite

Display global views using a Hammer projection with d3.js, everything else in a web mercator with Leaflet.js.

Edit: now with additional smoke and mirrors.

@jczaplew
jczaplew / countries_1e5.json
Created September 18, 2013 01:51
Adaptive Composite Map Projection example
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jczaplew
jczaplew / keybase.md
Created January 17, 2017 18:49
keybase.md

Keybase proof

I hereby claim:

  • I am jczaplew on github.
  • I am johnjcz (https://keybase.io/johnjcz) on keybase.
  • I have a public key whose fingerprint is 8FB0 0594 B47A F27F 890D 5EE6 969F F71E 2039 17F8

To claim this, I am signing this object:

@jczaplew
jczaplew / README.md
Last active January 11, 2017 09:23
Using d3.behavior.drag() with a map (updated)
document.querySelector('#g-model-promo.hp-promo-ccol .g-trump .g-label').style.float = 'none'
"none";
document.querySelector('#g-model-promo.hp-promo-ccol .g-trump .g-label').style.position = 'absolute';
document.querySelector('#g-model-promo.hp-promo-ccol .g-trump .g-label').style.right = '-5px'
"-5px";