Skip to content

Instantly share code, notes, and snippets.

View ryanpitts's full-sized avatar

Ryan Pitts ryanpitts

View GitHub Profile
@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
@ryanpitts
ryanpitts / gist:1135321
Created August 9, 2011 22:05
Pure CSS Boyle head
<table cellpadding=0 cellspacing=0 height=164 width=120 style="font-size:0px;height:164;width:120"><tr><td><table cellpadding=0 cellspacing=0 height=164 width=50 style="font-size:0px;height:164px;width:50px"><tr height=0><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /><td width=1 /></tr><tr height=2><td colspan=12 rowspan=20 bgcolor="#b7a07e" style="opacity:0;filter:alpha(opacity=0)"
<%
dim a(6)
a(0) = "<p><input type='checkbox' name='c'>&nbsp;When everything goes right, America's talented workers and entrepreneurs create millions and millions of jobs each year. While working families worry about job security and the unemployed struggle to find work, President Bush rewards wealthy campaign contributors with tax breaks that hurt the middle class and do nothing to create jobs.</p><br />"
a(1) = "<p><input type='checkbox' name='d'>&nbsp;The American middle class was built on the promises of good wages, fair benefits, job security and sound pension plans. A strong economy is built on a foundation of honest business practices.</p><br />"
a(2) = "<p><input type='checkbox' name='e'>&nbsp;My plan is to create jobs with a 10 percent tax credit for companies that keep jobs in America, a venture capital fund to bring jobs to those areas hardest hit in the economy, new tax credits for working Americans to buy their first home, save for retirement, or save for child's education.</p><br />"
a(3) =
<%
q1 = request.querystring("q1")
q2 = request.querystring("q2")
q3 = request.querystring("q3")
q4 = request.querystring("q4")
q5 = request.querystring("q5")
q6 = request.querystring("q6")
q7 = request.querystring("q7")
q8 = request.querystring("q8")
@ryanpitts
ryanpitts / loremipsum.js
Created September 20, 2011 20:08
Lorem Ipsum from Beowulf in Old English
/*
* Modified Lorem Ipsum Generator by Fredrik Bridell (http://bridell.com/loremipsum/)"
*
* To use: download the .js file, and in your html include the markup:
* <script type="text/javascript" src="loremipsum.js"></script>
*
* Where you want the Lorem Ipsum, include something like:
* <script type="text/javascript">loremIpsumParagraph(100)</script>
*/
@ryanpitts
ryanpitts / brotatoes.txt
Created October 9, 2011 20:10
Weekend potato recipe
Weekend potatoes (or Brotatoes, to annoy teenage sons)
Yep, when you break it down, these are pretty simple. But they taste
good like crack late on a Sunday morning.
-----------
INGREDIENTS
-----------
- a big-ass skillet (I use a 15-inch nonstick. Cast iron would be great.
@ryanpitts
ryanpitts / guinness_pie
Created October 17, 2011 20:31
Guinness pie recipe
Guinness pie
Another entry in an ongoing series: Things that your picky, but still very
hungry, teenage sons will eat. There are probably a lot of steps here that
you could get away with skipping to speed up the process, but this really
isn't a bad way to spend a couple hours on a Sunday afternoon.
Bonus: Plenty of leftovers.
-----------
INGREDIENTS
@ryanpitts
ryanpitts / gist:1304725
Created October 21, 2011 19:34
GROUP BY and Select MAX from each group in Django, 2 queries
'''
given a Model with:
category = models.CharField(max_length=32, choices=CATEGORY_CHOICES)
pubdate = models.DateTimeField(default=datetime.now)
<other fields>
Fetch the item from each category with the latest pubdate.
'''
@ryanpitts
ryanpitts / collect_facebook_stats.py
Created December 13, 2011 23:05
This script uses the Facebook API to fetch stats for a given list of URLs. We use it at year's end to compile a "most shared" story list.
"""
One of our editors thought it would be fun to run a year-end list of our
most-shared stories. This script uses the Facebook API to fetch stats for
a given list of URLs.
The script will:
- create a csv file that's named based on the value of TOP_URLS_FILE. This
file logs URLs that have enough shares to surpass your TOP_THRESHHOLD number.
@ryanpitts
ryanpitts / gist:1699580
Created January 29, 2012 16:42
Burns party 2012 tasting list
- Gordon & MacPhail bottling Caol Ila 16 cask strength
- Signatory bottling Bunnahabhain 9 cask strength
- Caol Ila 12 unpeated natural cask strength
- Lagavulin 16
- Bowmore 15
- Ardbeg Uigeadail
- Ardbeg Alligator
- Bunnahabhain 41
- Glen Ord 30
- Glenmorangie Finealta