Skip to content

Instantly share code, notes, and snippets.


Chris Keller chrislkeller

View GitHub Profile
chrislkeller / import_json_appsscript.js
Last active Nov 3, 2020
Adds what amounts to an =ImportJSON() function to a Google spreadsheet... To use go to Tools --> Script Editor and add the script and save.
View import_json_appsscript.js
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
chrislkeller /
Last active Oct 23, 2020
U.S. Supreme Court nominations over the years.

On Oct. 6, 2018, the U.S Senate on Saturday approved Brett Kavanaugh's nomination to the Supreme Court with a 50-48-1 vote, the narrowest margin for a confirmation vote in more than 130 years.

Kavanaugh's vote of 50-48-1 was 51.02%. Sen. Steve Daines (R-Mont.) was attending his daughter's wedding Saturday, and with Kavanaugh having enough other votes to win confirmation, Daines did not return to Washington for the vote. Sen. Lisa Murkowski (R-Alaska), who had planned to vote against Kavanaugh, instead voted “present” as a courtesy to Daines.

Kavanaugh Vote

This dataset was used as the basis for this piece in the L.A. Times:

I put this dataset together from a variety of sources, including:

chrislkeller /
Last active Sep 14, 2020
Convert string Lat/Long to number for Google Maps API.

Convert string Lat/Long to number for Google Maps API

When sending Lat/Long values to the Google Maps API for something like setCenter(), it wants an number value. But the value we pull from an option menu like the one below is a string.

<select id="searchString" onchange="zoomToAddress(this.value);">
<option value="">--Select All--</option>
<option value="43.138092,-89.747988">Luckenbooth Cafe</option>
<option value="43.017218,-89.831479">Aunt Mary's Hooterville Inn</option>
View requirements.txt
# -*- mode: shell-script -*-
# Shell functions to act as wrapper for Ian Bicking's virtualenv
# (
# Copyright Doug Hellmann, All Rights Reserved
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
chrislkeller /
Last active Apr 3, 2020
A couple quick bash scripts so I can keep virtualenvs somewhat consistent across machines. exports requirements files for each virtualenv, names the files for the virtualenv and sends them to a date-versioned directory. loops through a directory of requirements files and checks to see if a virtualen…
# grab the virtualenvwrapper settings
export WORKON_HOME=$HOME/.virtualenvs
# the location of your virtualenv wrapper shell script may differ
source /usr/local/share/python/
chrislkeller /
Last active Mar 18, 2020
Displaying data from a flat JSON file on a Handlebars.js template file rendered with AJAX.

Demo: ajax-handlebars

This repo's location has changed.

View north_county_fires.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
chrislkeller /
Last active Sep 29, 2019
SpreadSheet To Fusion Tables

Script to sync a Google SpreadSheet to a Fusion Table

Save for a few legacy projects that still use Fusion Tables I don't actively use this script anymore. This update hopefully solves the OAuth issue that cropped up once Google depcricated the Client Login method used by the prior version.

As always, your mileage may vary, and I welcome someone -- Google or otherwise -- to offer a long-term maintained solution.

The following is largely cribbed from a Google example here. I try to explain some of the API settings that must be enabled in the Developer's Console and elsewhere

Create your spr

chrislkeller / state_voter_reg_totals.csv
Last active Sep 17, 2019
Attempt to compile California Statement of Registration as submitted to the secretary of state since October 2001.
View state_voter_reg_totals.csv
We can make this file beautiful and searchable if this error is corrected: It looks like row 9 should actually have 19 columns, instead of 5. in line 8.
report_date,report_type,County,Eligible,Total Registered,Republican,Democratic,No Party Preference,American Independent,Americans Elect,Declined to State,Green,Libertarian,Miscellaneous,Natural Law,Other,Peace and Freedom,Reform,Unknown
2001-10-02,154 day,Alameda,944546.0,668305.0,133404.0,377745.0,,10902.0,,115770.0,14219.0,3458.0,8819.0,2325.0,,,1663.0,
2001-10-02,154 day,Alpine,939.0,777.0,312.0,271.0,,25.0,,146.0,5.0,7.0,4.0,1.0,,,6.0,
2001-10-02,154 day,Amador,24118.0,18615.0,8355.0,7352.0,,515.0,,1761.0,131.0,132.0,244.0,14.0,,,111.0,
2001-10-02,154 day,Butte,150308.0,112001.0,47518.0,41041.0,,3116.0,,15714.0,2217.0,802.0,1211.0,74.0,,,308.0,
2001-10-02,154 day,Calaveras,31480.0,24816.0,11029.0,9277.0,,646.0,,2960.0,239.0,375.0,120.0,43.0,,,127.0,
2001-10-02,154 day,Colusa,10756.0,7509.0,3347.0,3044.0,,200.0,,813.0,17.0,37.0,31.0,2.0,,,18.0,
2001-10-02,154 day,Contra Costa,651279.0,476935.0,154532.0,235612.0,,8349.0,,51760.0,4148.0,2282.0,17391.0,1064.0,,,1797.0,
2001-10-02,154 day,Del Norte,16754.0,126

NOTE: I'll work at fleshing this out a bit better

GOAL: Retrieve, catalog and display a daily record of voter registration figures in Orange County because a spokesperson for the registrar's office said they are unable to provide the figures.


  • Determine when the figures are updated each day
    • HOW: Phone conversation with registrar, reporter
  • Navigate to the O.C. URL that contains the daily figures
    • Create a scheduler
You can’t perform that action at this time.