Skip to content

Instantly share code, notes, and snippets.

@myersjustinc
myersjustinc / iframe_content.html
Created August 8, 2012 15:37
<iframe> location access tests
<!doctype html>
<html>
<head>
<title></title>
</head>
<body>
<a href="iframe_content_2.html">another page?</a>
</body>
</html>
@myersjustinc
myersjustinc / README.md
Created November 12, 2012 16:25
Rendering a CSV column as JSON

This script was developed to take a column of a CSV and render it as JSON. Because it was meant for U.S. choropleth maps, it makes a few assumptions about the input CSV's structure--specifically that it has at least three columns:

@myersjustinc
myersjustinc / README.md
Created November 12, 2012 19:30
AP results data retrieval and processing

We used these two scripts at the PBS NewsHour to update the live election-night results in our Vote 2012 Map Center with data from the Associated Press.

I've removed NewsHour-specific credentials, of course, as well as the part that uploaded JSON files to a PBS FTP server, so these haven't been tested in the form in which they're provided here--but retrieve_data.py downloaded the AP data files periodically from their FTP server to an internal HTTP server for our use, and update_json.py processed the files from that HTTP server into JSONP and pushed them to S3 for consumption by our users.

@myersjustinc
myersjustinc / README.md
Created November 19, 2012 17:05
mapnik failed to build on 10.8.2

Trying to install Mapnik on a Mac Pro (early 2009) with 10.8.2, but it isn't building for me.

The troubleshooting instructions ask for three things in this gist:

  • Output from HOMEBREW_MAKE_JOBS=1 VERBOSE=1 brew install mapnik, which are in brew-install.txt.
  • Largest numbered log from ~/Library/Logs/Homebrew/mapnik. No numbered logs existed in that directory yet, so I included the one file (config.log) that was present there.
  • Output from brew doctor, which is very unexciting but is included in brew-doctor.txt.
@myersjustinc
myersjustinc / adjustForInflation.js
Last active December 11, 2015 21:58
Quick function to adjust for inflation
var adjustForInflation = function(amount, yearFrom, yearTo) {
// Annual average CPI-U figures from BLS:
// http://www.bls.gov/cpi/cpifiles/cpiai.txt
//
// If you want the current year as well, BLS' inflation calculator suggests
// using the most recent monthly index value since there won't be an annual
// average available yet: http://www.bls.gov/cpi/cpicalc.htm
var cpi = {
1913: 9.9, 1914: 10.0, 1915: 10.1, 1916: 10.9, 1917: 12.8, 1918: 15.1,
1919: 17.3, 1920: 20.0, 1921: 17.9, 1922: 16.8, 1923: 17.1, 1924: 17.1,
@myersjustinc
myersjustinc / sheet_utils.py
Created May 13, 2013 17:43
Handle XLSX spreadsheet row contents as Python dicts
import openpyxl
def get_row_as_dict(ws, row_num):
header_cells = ws.rows[0]
record_cells = ws.rows[row_num]
record_dict = {}
for record_cell in record_cells:
header_name = None
@myersjustinc
myersjustinc / app.py
Created July 9, 2013 21:30
A quick test application in Flask
#!/usr/bin/env python
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
return 'Hello, world!'
@myersjustinc
myersjustinc / 02.make
Created November 20, 2013 20:19
gdal did not build on 10.9 when --with-mysql provided
This file has been truncated, but you can view the full file.
(cd port; /Applications/Xcode.app/Contents/Developer/usr/bin/make)
(cd gcore; /Applications/Xcode.app/Contents/Developer/usr/bin/make)
(cd frmts; /Applications/Xcode.app/Contents/Developer/usr/bin/make)
(cd ogr; /Applications/Xcode.app/Contents/Developer/usr/bin/make lib )
/bin/sh /private/tmp/gdal-0yub/gdal-1.10.1/libtool --mode=compile --tag=CXX clang++ -arch x86_64 -g -O2 -DHAVE_SSE_AT_COMPILE_TIME -Wall -DOGR_ENABLED -I/usr/local/Cellar/gdal/1.10.1/include -I/private/tmp/gdal-0yub/gdal-1.10.1/port -I/usr/local -I/usr/local/include -I/usr/local -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/opt/libpng -I/usr/local/opt/libpng/include -I/usr -I/usr/include -DHAVE_CURL -DHAVE_LIBZ -I/usr/local/Cellar/libxml2/2.9.1/include/libxml2 -DHAVE_LIBXML2 -c -o cpl_conv.lo cpl_conv.cpp
/bin/sh /private/tmp/gdal-0yub/gdal-1.10.1/libtool --mode=compile --tag=CXX clang++ -arch x86_64 -g -O2 -DHAVE_SSE_AT_COMPILE_TIME -Wall -I/private/tmp/gdal-0yub/gdal-1.10.1/port -I/private/tmp/gdal-0yu
@myersjustinc
myersjustinc / keybase.md
Created September 18, 2014 02:30
Keybase proof

Keybase proof

I hereby claim:

  • I am myersjustinc on github.
  • I am myersjustinc (https://keybase.io/myersjustinc) on keybase.
  • I have a public key whose fingerprint is 55C1 E8E1 E350 04EE 0F8A AC29 8FB6 0E44 B4A5 02BF

To claim this, I am signing this object:

@myersjustinc
myersjustinc / keybase.md
Created November 16, 2014 19:58
keybase.md

Keybase proof

I hereby claim:

  • I am myersjustinc on github.
  • I am myersjustinc (https://keybase.io/myersjustinc) on keybase.
  • I have a public key whose fingerprint is 7BBD 0FAE 3E22 A55E 5B22 024D 834B F8EF CB05 5E73

To claim this, I am signing this object: