Skip to content

Instantly share code, notes, and snippets.

I [tweeted](https://twitter.com/JoeGermuska/status/503183667624423424)
> I needed to convert these 58 pseudo-JSON files to real JSON. How would you do it?
> https://github.com/NUKnightLab/TimelineJS/tree/master/source/js/Core/Language/locale … (Kinda proud of my solution TBH)
Here's what I did.
Noah Veltman had [a much leaner solution](https://gist.github.com/veltman/8822eb9a25488c228a52) that used NodeJS. I'm not very savvy with Node, although I started down a solution like Noah's. I got stuck because I didn't consider changing the source files.
@JoeGermuska
JoeGermuska / README.md
Last active August 29, 2015 14:07
Debugging CGAL problem en route to brew install postgis

I was trying to brew install postgis and got an error on the cgal dependency.

It looks like maybe it has to do with boost, but according to the CGAL manual, I have a suitable Boost version (>1.39)

@JoeGermuska
JoeGermuska / README.md
Last active February 14, 2017 02:50
Put Census shapes on your map

If you want to add Census shapes to your leaflet map, why not use Census Reporter's data?

To get some idea of what's available, pick a summary level from the menu at the top of the page. Depending on the summary level, the map will zoom to a sort of arbitrarily "close" level. This is because our server will, like a loyal dog, try to fetch all the features at whatever you ask for, but it doesn't deal very well with requests for lots of features. You can experiment a little by zooming out after you pick a small summary level. Of course, while you're doing that, you're sorta grinding our servers, so don't go nuts.

Note: We're working on encapsulating this into something you can do even more simply. Just need to work out a few fine points of default behavior and how much we need to do to actually make it simple.

We would love to refine this service so that it works more flexibly for all su

@JoeGermuska
JoeGermuska / cr-api-pandas.py
Last active April 25, 2016 15:49
Using Census Reporter API with Pandas
import pandas as pd
import requests
API_URL="http://api.censusreporter.org/1.0/data/show/{release}?table_ids={table_ids}&geo_ids={geoids}"
def get_data(tables=None, geoids=None, release='latest'):
if geoids is None:
geoids = ['040|01000US']
if tables is None:
tables = ['B01001']
@JoeGermuska
JoeGermuska / gist:88eef44105c6f131139d
Created March 13, 2015 01:37
format backers as table
function make_row(ary) {
var tr = $("<tr>")
for (var i = 0; i < ary.length; i++) {
$(tr).append("<td>" + ary[i] + "</td>")
}
return tr;
}
cols = ['idx','backer_count','mystery','base_pledge','total_pledged']
var table = $('<table>');
$(table).append(make_row(cols));
@JoeGermuska
JoeGermuska / index.html
Last active August 29, 2015 14:20
Cities where Black median income is substantially higher than White median income
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>where_blacks_earn_more</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
@JoeGermuska
JoeGermuska / gct_tables.txt
Created November 17, 2015 22:36
A list of American Community Survey (ACS) tables in the Geographic Comparison Tables series
GCT0101 MEDIAN AGE OF THE TOTAL POPULATION - United States -- States; and Puerto Rico
GCT0101 MEDIAN AGE OF THE TOTAL POPULATION - United States -- American Indian Area/Alaska Native Area/Alaska Native Regional Corporation
GCT0101 MEDIAN AGE OF THE TOTAL POPULATION - United States -- Congressional District by State; and for Puerto Rico
GCT0101 MEDIAN AGE OF THE TOTAL POPULATION - United States -- County by State; and for Puerto Rico
GCT0101 MEDIAN AGE OF THE TOTAL POPULATION - United States -- Places by State; and for Puerto Rico
GCT0101 MEDIAN AGE OF THE TOTAL POPULATION - United States -- Metropolitan and Micropolitan Statistical Area; and for Puerto Rico
GCT0101 MEDIAN AGE OF THE TOTAL POPULATION - United States -- Urban/Rural and Inside/Outside Metropolitan and Micropolitan Area
GCT0101 MEDIAN AGE OF THE TOTAL POPULATION - United States -- Urbanized Area; and for Puerto Rico
GCT0101 MEDIAN AGE OF THE TOTAL POPULATION - United States -- Combined Statistical Area with Metropolitan and Micropolitan Statistic
@JoeGermuska
JoeGermuska / b01003_140_10_moe.csv
Created November 18, 2015 04:01
ACS 2013-5 year table B01003 for all tracts in US
We can't make this file beautiful and searchable because it's too large.
geoid,b01003001,b01003001_moe
14000US02013000100,3141,0
14000US02016000100,1176,192
14000US02016000200,4362,192
14000US02020000101,6215,631
14000US02020000102,5169,760
14000US02020000201,4127,413
14000US02020000202,6136,547
14000US02020000203,11099,628
14000US02020000204,3956,353
@JoeGermuska
JoeGermuska / info.md
Last active March 12, 2016 22:33
Fixing Keybase/GPG 'Legacy key' errors

I had used keybase successfully on my Mac. After some time, I went to track someone and got this error:

error: `gpg` exited with code 2
warn: gpg: error reading key: Legacy key

I had no luck googling for answers, but a @mtigas suggested that I try

gpg2 --list-secret-keys

That revealed a very old dsa1024 key I had installed (expired in 2005). I tried

@JoeGermuska
JoeGermuska / timeline-unminified.css
Created May 20, 2016 15:38
Unminified Timeline CSS for easier reading
/*
TimelineJS - ver. 3.3.14 - 2016-03-22
Copyright (c) 2012-2015 Northwestern University
a project of the Northwestern University Knight Lab, originally created by Zach Wise
https://github.com/NUKnightLab/TimelineJS3
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/*!
Timeline JS 3