Skip to content

Instantly share code, notes, and snippets.

View techieshark's full-sized avatar

Peter W techieshark

View GitHub Profile
@techieshark
techieshark / fb-event-attendees.html
Created December 8, 2011 02:28
List of people who responded yes/maybe to Facebook event
<html>
<head>
<title>Facebook Evevt Attendees</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="yes.js"></script>
<script type="text/javascript" src="maybe.js"></script>
<script type="text/javascript">
// code modified from http://www.zachhunter.com/2011/06/json-to-csv/
@techieshark
techieshark / fix_vancouver.csv
Created January 3, 2012 03:27
Location of Vancouver, WA for Managing News
Name Lat Lon Parent
Vancouver 45.63 -122.60 United States
@techieshark
techieshark / find.us.sh
Created January 10, 2012 02:12
Bash script to check for unused .us domains.
for i in `cat more.words.us`; do
if [ -z "`dig $i +short`" ]; then
echo $i; echo $i | sed 's/\.//' | xargs dict;
fi;
done;
@techieshark
techieshark / drupal_vocabs_nodecounts.sql
Created January 10, 2012 23:31
(Drupal) SQL to count #nodes in each term in each vocabulary.
SELECT v.vid, v.name AS Vocabulary, td.tid, td.name AS Term, (SELECT count(*) FROM drupal_node n JOIN drupal_term_node tn2 ON n.nid = tn2.nid WHERE tn2.tid = td.tid) AS Count FROM drupal_vocabulary v JOIN drupal_term_data td ON v.vid = td.vid ORDER BY Count DESC;
# Git
alias ga='git add'
alias gbs='git bisect'
alias gbl='git blame'
alias gb='git branch'
alias gco='git checkout'
alias gc='git commit'
alias gcl='git clone'
alias gcp='git cherry-pick'
alias gd='git diff'
@techieshark
techieshark / gist:67891cae67e44db0483a
Created June 1, 2014 17:25
Campaign finance questions
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 June 1, 2014 21:53
Oregon Campaign Finance Exploration
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 June 2, 2014 02:08
2013 Oregon Political Spenders
# 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
---------------------------------------------------------------------------------+------+-------------
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<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%;