Skip to content

Instantly share code, notes, and snippets.

Avatar

Peter W techieshark

View GitHub Profile
View gist:67891cae67e44db0483a
Some questions that could be answered by the campaign finance database:
- How much money has been raised in Oregon in 2014? (In state? Out of state?)
- How much money has been spent in Oregon in 2014? (In state? Out of state?)
- Where is the money being spent on? (ex: bar chart, or maybe a wordle of the descriptions)
- How many unique donors are there in Oregon politics (in 2014)?
- What are the three most grass roots PACs? (most unique donations)
- What are the three least grass roots PACs? (fewest unique donations)
- What are the five PACs who have the highest % of their funding from out of state? (And what is that %?)
@techieshark
techieshark / 2013-Oregon-PACs-by-cash-raised.txt
Created Jun 1, 2014
Oregon Campaign Finance Exploration
View 2013-Oregon-PACs-by-cash-raised.txt
campaign_finance=# SELECT filer, ceil(SUM(amount))::text::money as total FROM raw_committee_transactions WHERE tran_date >= '2013-01-01' AND tran_date <= '2013-11-05' AND sub_type LIKE 'Cash Contribution' GROUP BY filer ORDER BY total;
filer | total
-------------------------------------------------------------------------------------+-------------
Friends of LaVonne Griffin-Valade | $2.00
Voter Approval of Urban Renewal | $5.00
Limit City Debt | $5.00
Jeremy Ferguson for Mayor | $5.00
Friends of Sal Peralta | $9.00
New Covenant PAC |
@techieshark
techieshark / political-spenders.txt
Created Jun 2, 2014
2013 Oregon Political Spenders
View political-spenders.txt
# Biggest spenders in Oregon Politics, in 2013.
# spender: the candidate or PAC
# freq: the number of times they gave to another candidate or PAC
# total: the sum of all contributions the spender made to another candidate or PAC
# using the database found here: https://github.com/hackoregon/backend
campaign_finance=# SELECT contributor_payee AS spender, COUNT(amount) as Freq, ceil(SUM(amount))::text::money as Total FROM raw_committee_transactions WHERE sub_type LIKE 'Cash Contribution' AND contributor_payee_committee_id IS NOT NULL AND tran_date >= '2013-01-01' AND tran_date <= '2013-12-31' GROUP BY spender ORDER BY total DESC;
spender | freq | total
---------------------------------------------------------------------------------+------+-------------
View 14-0561.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View designer.html
<link rel="import" href="../paper-radio-group/paper-radio-group.html">
<link rel="import" href="../paper-radio-button/paper-radio-button.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 50%;
View event-ids
1924, 1925, 1926, 1927, 1928, 1235, 1237, 1245, 1246, 1250, 1251, 1252, 1253, 1255, 1256, 1265, 1269, 1270, 1272, 1277, 1280, 1283, 1285, 1287, 1290, 1292, 1295, 1297, 1298, 1300, 1301, 1302, 1303, 1304, 1305, 1306, 1311, 1312, 1313, 1314, 1315, 1317, 1318, 1321, 1322, 1323, 1325, 1326, 1327, 1328, 1329, 1330, 1331, 1332, 1333, 1334, 1335, 1339, 1341, 1342, 1345, 1348, 1350, 1352, 1354, 1355, 1357, 1359, 1360, 1362, 1363, 1372, 1380, 1389, 1391, 1393, 1396, 1398, 1405, 1406, 1407, 1409, 1410, 1413, 1414, 1416, 1417, 1420, 1422, 1423, 1425, 1426, 1430, 1431, 1433, 1437, 1438, 1439, 1440, 1441, 1443, 1445, 1447, 1448, 1449, 1451, 1452, 1456, 1457, 1459, 1460, 1461, 1462, 1464, 1472, 1473, 1474, 1475, 1476, 1477, 1478, 1479, 1480, 1482, 1483, 1484, 1485, 1486, 1488, 1490, 1491, 1492, 1493, 1496, 1497, 1498, 1499, 1500, 1502, 1503, 1506, 1507, 1508, 1509, 1510, 1511, 1512, 1513, 1514, 1515, 1516, 1517, 1518, 1519, 1520, 1521, 1522, 1524, 1525, 1526, 1529, 1530, 1533, 1535, 1536, 1537, 1538, 1539, 1540, 1541, 1543
@techieshark
techieshark / README.md
Last active Aug 29, 2015 — forked from mbostock/.block
Contributions by size and day to Scott Wiener's 2010 SF Campaign
View README.md

Data retrieved Aug 9th, 2014 at the SF Ethics / Campaign Finance hackathon.

I did little to this visualization other than changing the data from that used in the original gist.

Original gist's description: This example demonstrates loading of CSV data, which is then quantized into a diverging color scale. The values are visualized as colored cells per day. Days are arranged into columns by week, then grouped by month and years. Colors by Cynthia Brewer. Layout inspired by Rick Wicklin and Robert Allison.

View legistar.rb
module Legistar
module_function
# Takes objects with camel case property names and converts
# to ruby format.
# camelcase_object: just SomeObject object which needs to have
# SomeObjectPropertyNames changed to property_names
# prefix_to_strip: any CamelCase part like 'SomeObject' which should be
# removed before converting the rest of the name to snake_case
@techieshark
techieshark / index.html
Last active Aug 29, 2015
color generator. co-wrote with @ainsleywagon
View index.html
<html>
<body>
<!--
<button data-state="name" data-name="MistyRose" data-hex='FFE4E1' data-rgb='255,228,225' class="col-md-1">MistyRose</button>
<button data-state="name" data-name="Blue" data-hex='0000FF' data-rgb='0,0,255' class="col-md-1">Blue</button> -->
<div id="favs"></div>
<div id="unfavs"></div>
View switch.sh
# we had an existing postgres db on heroku and wanted to switch to another (larger or smaller)
heroku addons:add heroku-postgresql:standard-0 # standard-0 is the $50/mo database we want
heroku pg:wait # exits once the database is ready
heroku pg:info # figure out the new db's name… for this example it is HEROKU_POSTGRESQL_RED_URL, yours may differ
heroku pgbackups:transfer DATABASE_URL HEROKU_POSTGRESQL_RED_URL #copy all the data and enabled extensions
heroku pg:promote HEROKU_POSTGRESQL_RED_URL #make this db accessible via the DATABASE_URL name instead of this long but colorful one