Skip to content

Instantly share code, notes, and snippets.

View hepplerj's full-sized avatar
💭
building the history web

Jason Heppler hepplerj

💭
building the history web
View GitHub Profile
@hepplerj
hepplerj / multiserver.js
Last active September 19, 2017 17:40
Checking server connections
var http = require('http');
function handler(req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello world\n');
}
http.createServer(handler).listen(3000, '127.0.0.1');
http.createServer(handler).listen(3001, 'localhost');
http.createServer(handler).listen(3002, '127.0.0.1'); // ifconfig
http.createServer(handler).listen(3003, 'host.example.com'); // echo $HOSTNAME
@hepplerj
hepplerj / gdal.sh
Created May 26, 2017 13:25
A script for setting up GDAL on Ubuntu 12.04
# Install subversion
sudo apt-get -y install subversion
# Install g++
sudo apt-get -y install g++
# Install Hierarchical Data Format library
sudo apt-get -y install libhdf4-alt-dev
# Get trunk of gdal
@hepplerj
hepplerj / geojson_convert.sh
Created May 10, 2017 14:44
Bulk convert shapefiles to geojson
# Bulk convert shapefiles to geojson
function shp2geojson() {
ogr2ogr -f GeoJSON -t_srs crs:84 "$1.geojson" "$1.shp"
}
for var in *.shp; do shp2geojson ${var%\.*}; done

Keybase proof

I hereby claim:

  • I am hepplerj on github.
  • I am jaheppler (https://keybase.io/jaheppler) on keybase.
  • I have a public key ASDXbDTSmWJiyDZ6URLp6rKUdG-84IRsPjYEJWYog7YOcgo

To claim this, I am signing this object:

@hepplerj
hepplerj / scc-tracts.geojson
Created March 28, 2017 20:27
Census tracts
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hepplerj
hepplerj / README.md
Last active March 27, 2017 18:36
TopoJSON merge

Testing topojson.merge to merge multiple polygons into a single polygon.

@hepplerj
hepplerj / index.html
Last active March 27, 2017 18:28
Threshold scale
<!DOCTYPE html>
<svg width="960" height="500"><g transform="translate(360,250)"></g></svg>
<script src="https://d3js.org/d3.v4.min.js"></script>
<script>
var formatPercent = d3.format(".0%"),
formatNumber = d3.format(".0f");
var threshold = d3.scaleThreshold()
.domain([0.11, 0.22, 0.33, 0.50])
@hepplerj
hepplerj / README.md
Last active March 20, 2017 02:40
Using WMS in maps

Using WMS in web maps.

@hepplerj
hepplerj / index.html
Last active April 20, 2019 01:46
Minard map
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<!-- D3.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js" charset="utf-8"></script>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Cardo:400,400italic,700' rel='stylesheet' type='text/css'>
@hepplerj
hepplerj / superfund.R
Created June 15, 2016 20:24
Data prep for DHSI
# Superfund sites CSV
calif_superfund_sites <- read.csv("./data/calif_superfund_sites.csv")
# We'll clean up the Superfund data a bit, selecting only
# the columns we want to keep.
calif_superfund_sites <- calif_superfund_sites %>%
select(NAME, CITY,STATE,ZIP,LONGITUDE,LATITUDE,STATUSDATE,HRS_SCORE)
# Let's filter out California sites.
calif_superfund_sites <- subset(calif_superfund_sites,
STATE %in% "CA")
# Convert the date into an R friendly version.