This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
A very simple client for basic access to the Twitter API. | |
import tweets | |
client = tweets.TwitterClient(CONSUMER_KEY, CONSUMER_SECRET) | |
client.get_access_token() # complete authentication and enter PIN | |
client.get('statuses/home_timeline') | |
Requirements: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Create an RSS feed from your Tumblr dashboard and write to S3. | |
Run with -x command to write to stdout instead of pushing to S3. | |
Requirements: | |
boto | |
python-s3file | |
PyRSS2Gen | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
METADATA_ELEMENTS = ('command', 'link', 'meta', 'noscript', 'script', 'style') | |
PHRASING_ELEMENTS = ('a', 'abbr', 'area', 'audio', 'b', 'bdo', 'br', 'button', | |
'canvas', 'cite', 'code', 'command', 'datalist', 'del', 'dfn', 'em', 'embed', | |
'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'keygen', 'label', 'map', 'mark', | |
'meter', 'noscript', 'object', 'output', 'progress', 'q', 'ruby', 'samp', | |
'script', 'select', 'small', 'span', 'strong', 'sub', 'sup', 'textarea', | |
'time', 'var', 'video') | |
FLOW_ELEMENTS = ('address', 'article', 'aside', 'blockquote', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def rejigger(src): | |
dst = {} # dict to hold new structure | |
# iterate over keys and values in source dict | |
for key, value in src.iteritems(): | |
set_value(dst, key.split('.'), value) | |
return dst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Generate an iCalendar file from the Frederick County, VA Government | |
RSS feed of events. | |
Requirements: | |
feedparser | |
icalendar | |
""" | |
from datetime import datetime | |
import sys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$().ready(function() { | |
var images = [ | |
'gingrich', | |
'huntsman', | |
'obama', | |
'paul', | |
'romney', | |
'santorum' | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import logging | |
import os | |
import random | |
import sys | |
import time | |
import urllib | |
import urllib2 | |
logger = logging.getLogger("highfive") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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): |