Skip to content

Instantly share code, notes, and snippets.

View ryanpitts's full-sized avatar

Ryan Pitts ryanpitts

View GitHub Profile
#!/bin/bash
# Using `ffmpeg` to convert an arbitrary video file to an ipad-compatible M4V (h264+AAC)
# file. Mac-specific since libfaac has occasional audio glitches and the `afconvert` command
# is of a much higher quality (since it uses the system's Quicktime libs).
# Assumes ffmpeg and x264 (and other libs ffmpeg uses to decode various video formats
# you want) are installed.
#
# Easy mode:
# * Install homebrew: http://github.com/mxcl/homebrew
@palewire
palewire / AP_STATES_NORMALIZATION.py
Created April 21, 2011 22:50
A crosswalk that converts state names and abbreviations to A.P. style.
AP_STATES_NORMALIZATION = {
'ak': 'Alaska',
'al': 'Ala.',
'ala': 'Ala.',
'alabama': 'Ala.',
'alaska': 'Alaska',
'american samao': 'A.S.',
'american samoa': 'A.S.',
'ar': 'Ark.',
'ariz': 'Ariz.',
@ryanpitts
ryanpitts / Hartnett Command Performance
Created May 11, 2011 19:11
Let your Mac read you the latest @wmhartnett updates from Twitter
read -a choices <<<'Agnes Kathy Princess Vicki Victoria Bruce Fred Junior Ralph Albert Bahh Bells Boing Bubbles Cellos Deranged Hysterical Trinoids Whisper Zarvox'; n=${#choices[*]}; voice=${choices[$((RANDOM%n))]}; curl https://api.twitter.com/1/statuses/user_timeline.rss?screen_name=wmhartnett | grep '<description>.*</description>' | sed -e 's/<\/*description>//g' -e 's/ \/ wmhartnett//g' -e 's/wmhartnett: //g' | say -v $voice
@dokterbob
dokterbob / next_previous.py
Created June 2, 2011 10:19
Django template tag to efficiently get the next or previous object in the Django queryset, with regards to the item specified.
from django import template
register = template.Library()
from templatetag_sugar.register import tag
from templatetag_sugar.parser import Constant, Variable, Name
from .utils import get_next_or_previous
"""
Efficient and generic get next/previous tags for the Django template language,
@myersjustinc
myersjustinc / countyFIPS.js
Created September 21, 2011 21:55
Mappings between five-digit county FIPS codes and their corresponding counties
// Source: http://www.census.gov/geo/www/ansi/countylookup.html
var countyToFIPS = {
'Alabama': {
'Autauga County': '01001',
'Baldwin County': '01003',
'Barbour County': '01005',
'Bibb County': '01007',
'Blount County': '01009',
'Bullock County': '01011',
@jeremyjbowers
jeremyjbowers / views.py
Created October 14, 2011 19:11
An example of class-based views in use at the Washington Post.
from django.views.generic import dates
from django.views.generic.list import ListView
from django.views.generic.detail import DetailView
from django.contrib.syndication.views import Feed
from django.shortcuts import get_object_or_404
from django.db.models import Q, Count, Aggregate
from fallen.models import Casualty, Theater, Branch, HomeState, CauseOfDeath, IncidentProvince
from django.template.defaultfilters import upper
from haystack.views import SearchView
import datetime
@mtigas
mtigas / gist:1335214
Created November 2, 2011 22:57
Because you've always wanted a terminal screen tracking a live stream of "bieber" tweets.
@brianboyer
brianboyer / gist:1696819
Created January 29, 2012 02:21
Lion dev environment notes
@ashaw
ashaw / simple-fb-app.html
Created August 28, 2012 13:09
Simple FB JavaScript app example for HHBA
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
</head>
<body>
<div id="fb-root"></div>
<script src="//connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({
  • don't blow your deadline
  • don't be wrong