Skip to content

Instantly share code, notes, and snippets.

View jcarbaugh's full-sized avatar
🍳

Jeremy Carbaugh jcarbaugh

🍳
View GitHub Profile

Keybase proof

I hereby claim:

  • I am jcarbaugh on github.
  • I am jcarbaugh (https://keybase.io/jcarbaugh) on keybase.
  • I have a public key whose fingerprint is E091 3E44 E120 8073 5B9D C05E 08E1 D212 24F6 DCC0

To claim this, I am signing this object:

@jcarbaugh
jcarbaugh / SFAutomaticPagingCongressAPIClient.py
Last active December 31, 2015 06:29
A paging wrapper for python-sunlight?
import sunlight.services.congress
class PseudoService(object):
def __init__(self):
self.service = self.service_class()
def __getattr__(self, name):
attr = getattr(self.service, name)
@jcarbaugh
jcarbaugh / serve
Last active December 26, 2015 08:49
Start a local server. Specify server and port.
#!/bin/bash
PORT=8000
IP=127.0.0.1
while getopts p: opt; do
case $opt in
i)
IP=$OPTARG
echo "Setting IP address to $IP"
@jcarbaugh
jcarbaugh / json-ld.js
Last active December 17, 2015 06:59
JSON-LD v plain old JSON
{
format: "linked-data-api",
version: "0.2",
result: {
_about: "http://environment.data.gov.uk/doc/bathing-water/ukl1702-36800.json",
definition: "http://environment.data.gov.uk/meta/doc/bathing-water/_eubwid.json",
extendedMetadataVersion: "http://environment.data.gov.uk/doc/bathing-water/ukl1702-36800.json?_metadata=all",
primaryTopic: {
_about: "http://environment.data.gov.uk/id/bathing-water/ukl1702-36800",
country: {
@jcarbaugh
jcarbaugh / mmmsaucebrush.py
Last active December 11, 2015 06:08
An example of using python-saucebrush with legislators.csv from the Sunlight Foundation Congress API bulk download.
from saucebrush import emitters, filters, sources, stats
import saucebrush
import us
CHAMBERS = {"House": "Rep", "Senate": "Sen"}
STATES = [s.abbr for s in us.STATES]
TERRITORIES = [t.abbr for t in us.TERRITORIES]
class StateFilter(filters.ConditionalFilter):
@jcarbaugh
jcarbaugh / highfive.py
Created November 4, 2012 18:43
High five, bro!
#!/usr/bin/env python
import logging
import os
import random
import sys
import time
import urllib
import urllib2
logger = logging.getLogger("highfive")
@jcarbaugh
jcarbaugh / gist:3995708
Created November 1, 2012 18:54
sfapp base template
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="static/css/bootstrap.min.css">
<link rel="stylesheet" href="static/css/sfapp.css">
<script type="text/javascript" src="http://use.typekit.com/tab6neo.js"></script>
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
</head>
@jcarbaugh
jcarbaugh / mediasync.py
Created April 6, 2012 21:25
mediasync-style storage backend using django-storages
import base64
import hashlib
import mimetypes
import os
import threading
from boto.s3.key import Key
from django.conf import settings
from django.core.files.storage import get_storage_class
from storages.backends.s3boto import S3BotoStorage
@jcarbaugh
jcarbaugh / memory.js
Created April 2, 2012 16:06
memory card game
$().ready(function() {
var images = [
'gingrich',
'huntsman',
'obama',
'paul',
'romney',
'santorum'
];
@jcarbaugh
jcarbaugh / frederickco-feed2ical.py
Created September 20, 2011 15:12
Convert Frederick County, VA events feed to iCalendar
""" Generate an iCalendar file from the Frederick County, VA Government
RSS feed of events.
Requirements:
feedparser
icalendar
"""
from datetime import datetime
import sys