Skip to content

Instantly share code, notes, and snippets.

View bill-sections-nested.js
// /bill.json?bill_id=hr3590-111&apikey=[yourApikey]&sections=last_action.type,sponsor.last_name
{bill: {
last_action: {
type: "enacted"
},
sponsor: {
last_name: "Rangel"
}
}}
@sunlightlabs
sunlightlabs / gist:356427
Created Apr 5, 2010
sunlight congress api example responses
View gist:356427
{"response":
{"legislator":
{"district":"8",
"title":"Rep",
"eventful_id":"P0-001-000016548-5",
"in_office":true,
"state":"CA",
"crp_id":"N00007360",
"official_rss":"",
"party":"D",
View parse_house_disclosures.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
This script was used to convert the 2009 Q3 House Disbursement PDF into detail and summary CSV files.
Source PDF: http://disbursements.house.gov/
Resulting Data: http://www.sunlightfoundation.com/projects/2009/expenditures/
It was originally authored by Luke Rosiak with improvements by James Turk for Sunlight Labs and is released into the public domain.
View recoveryviews.py
from django.contrib.gis.geos import Point
from django.contrib.gis.measure import D
from django.contrib.humanize.templatetags.humanize import intcomma
from layar import POI, LayarView
from recovery.models import AwardSite
class RecoveryLayarView(LayarView):
def get_recoverygov_queryset(self, latitude, longitude, radius,
search_query, slider_value, **kwargs):
qs = AwardSite.objects.filter(location__distance_lt=(Point(longitude, latitude),
View campfire-notifier.rb
### Taken from http://blog.pothoven.net/2008/09/campfire-activity-notifier-for-gnome.html
### Posted here in case that site disappears, and so I can find it more easily
#!/usr/bin/env ruby
# == Synopsis
# Program to monitor a campfire chat room
# Modified from code provided at: http://www.snailbyte.com/2007/09/13/campfire-activity-notifier-for-kde/
#
# == Usage
@sunlightlabs
sunlightlabs / levenshtein.rb
Created Aug 19, 2009
Ruby C implementation of Levenshtein
View levenshtein.rb
# C implementation of Levenshtein text distance algorithm, uses RubyInline to call from within Ruby
# Wildly faster than the Text gem's Text::Levenshtein
# Example:
# l = Levenshtein.new
# l.distance 'hello', ' hello'
# => 1
# Taken from http://www.benallfree.com/2008/10/05/finding-duplicate-text-with-ruby/
View vote_similarity.py
Rep. Larry Kissell (D-NC),Rep. Sue Myrick (R-NC),0.511210762332
Rep. G.K. Butterfield (D-NC),Rep. Walter Jones (R-NC),0.543241843604
Rep. G.K. Butterfield (D-NC),Rep. Mike McIntyre (D-NC),0.911302584896
Rep. Patrick McHenry (R-NC),Rep. Brad Miller (D-NC),0.380952380952
Rep. Bob Etheridge (D-NC),Rep. Walter Jones (R-NC),0.575697211155
Rep. Howard Coble (R-NC),Rep. Mike McIntyre (D-NC),0.470734126984
Rep. Howard Coble (R-NC),Rep. Walter Jones (R-NC),0.800102511533
Rep. G.K. Butterfield (D-NC),Rep. Heath Shuler (D-NC),0.850261780105
Rep. Bob Etheridge (D-NC),Rep. Patrick McHenry (R-NC),0.393017456359
Rep. Bob Etheridge (D-NC),Rep. Heath Shuler (D-NC),0.875062468766
You can’t perform that action at this time.