Skip to content

Instantly share code, notes, and snippets.

View chrislkeller's full-sized avatar

Chris Keller chrislkeller

View GitHub Profile
@chrislkeller
chrislkeller / README.md
Last active December 11, 2015 22:19
Super simple shell script to take boilerplate FOIA language and create a markdown file.

Snippets: Creating a FOIA

This is a super simple shell script that takes boilerplate FOIA language and creates a markdown file that can be addressed to a particular agency.

You will still have to add the address, city, state and zip code of the agency, and the type of data being requested, but this is a step up from having a file that I copy and paste from.

The script takes a filename as an argument. That filename will have the date prepended to it so you can see at a glance which were sent out when.

Usage

@chrislkeller
chrislkeller / README.md
Last active March 13, 2018 15:19
A pair of python scripts to create a flat json file from a given csv file that can be used in a handlebars.js template.

Snippets: Build a flat json file for handlebars.js template or jquery-vertical-timelines

UPDATED I've made some updates to the handlebars-json.py script.

  • Script now accepts a "usage" argument for "handlebars" or "timeline" or "array"
  • Script assumes a header row and strips underscores and spaces and converts header fields to lowercase when creating keys.
  • Because the resulting JSON file can also be used to power Vertical Timelines, I've re-named the script to csv-to-json.py.
  • The handlebars-json-csvkit.py script remains unchanged. I will attempt to re-work it to create handlebars or timeline JSON in the coming weeks.

See more in the Usage section below.

var KpccClient;
KpccClient = (function() {
KpccClient.prototype.baseUrl = "http://scpr.org/api/content";
function KpccClient(apiKey) {
this.apiKey = apiKey;
}

Building things with Tabletop.js and Handlebars.js

Description

Maybe you've used pre-packaged vendor tools to create digital news presentations, but you aren't quite ready to tackle full-stack programming, database management and server setup.

Maybe you're hoping reporters will learn how keeping structured data about their beat can benefit the organization.

Or maybe you're looking for a tool that help organize/display information when that breaking news event happens.

@chrislkeller
chrislkeller / west_wing.coffee
Last active December 17, 2015 20:08
A simple experiment with coffeescript, writing a hubot script with random west wing quotes...
# Description:
# West Wing Quotes
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
@chrislkeller
chrislkeller / import_json_appsscript.js
Last active March 25, 2024 19:45
Adds what amounts to an =ImportJSON() function to a Google spreadsheet... To use go to Tools --> Script Editor and add the script and save.
/**
* 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
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
@chrislkeller
chrislkeller / fire_scraper.py
Last active December 18, 2015 13:19
A simple example of a scraperwiki python scraper for a recent Hacks/Hackers L.A. meetup...
#!/usr/bin/env python
import logging
import re
import time, datetime
import mechanize
from BeautifulSoup import BeautifulSoup, Tag, BeautifulStoneSoup
# log everything and send to stderr
logging.basicConfig(level=logging.DEBUG)
@chrislkeller
chrislkeller / gist:6016345
Last active March 5, 2021 19:35
Query the KPCC article API

Function to query API

    class kpcc_api_article():
        def __init__(self, permalink, image_asset, publish_date, short_title):
            self.user = permalink
            self.text = image_asset
            self.graphic = publish_date
            self.time = short_title

search kpcc api for related articles to display on detail pages

@chrislkeller
chrislkeller / requirements.txt
Last active July 15, 2020 06:01
virtualenv.sh
# -*- mode: shell-script -*-
#
# Shell functions to act as wrapper for Ian Bicking's virtualenv
# (http://pypi.python.org/pypi/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
chrislkeller / crowdsourced-map.md
Last active December 20, 2015 16:09
Source Blog post on using Google Apps Scripts to automate some tasks needed for a crowdsourced map...

Back in November, on my second day at KPCC, I collaborated with Kim Bui on a crowd-sourced map that attempted to gather information from voters who wanted to share their experience at the polls.

We successfully powered the map using a bunch of Google tools -- a form, a spreadsheet and a Fusion Table -- along with some duct tape and some manual labor.

Some six months later I've become more comfortable here, and more comfortable with Google Apps Scripts thanks to some great examples from others. So as I re-purposed the idea for an election back in M