Skip to content

Instantly share code, notes, and snippets.

View jcsalterego's full-sized avatar

Jerry Chen jcsalterego

View GitHub Profile
namespace :britt do
desc 'Removes trailing whitespace and tabs'
task :space do
sh %{find . -name '*.rb' -exec sed -i '' -e 's/[`echo -ne "\t"` ]*$//g' {} \\;}
end
end
<?php
class SmartXML implements ArrayAccess
{
private var $xml;
public __construct($xml)
{
$this->xml = $xml;
}
<?php
$xml = new SimpleXMLElement('<sitemap></sitemap>');
foreach ($pages as $page)
$page_xml = $xml->addChild('page');
$page_xml->addChild('loc', $page['loc']);
$page_xml->addChild('priority', $page['priority']);
$page_xml->addChild('changefreq', $page['changefreq']);
}
@jcsalterego
jcsalterego / shift_back.user.js
Created January 24, 2009 01:00
Bringing back the shift key on the Twitter web interface
// ==UserScript==
// @name Shift back
// @namespace http://twitter.com
// @include http://twitter.com/*
// ==/UserScript==
$ = unsafeWindow.jQuery;
var tab_hijack = function(e) {
if (e.keyCode == 9) {
@jcsalterego
jcsalterego / hashtag_wordle.py
Created January 28, 2009 13:07
Script to generate word list from search results
#!/usr/bin/env python
#
# Generates non-unique word list from Twitter Search meeting certain
# criteria (as set in the configuration, below).
#
# EXAMPLE (word wrap inserted for ease of reading):
#
# $ python hashtag_wordle.py
# Fetching http://search.twitter.com/search.json?q=%23spinuzzi-project&rpp=30&page=1...
# Fetching http://search.twitter.com/search.json?q=%23spinuzzi-project&rpp=30&page=2...
$ ./scrape.py
Fetching http://search.twitter.com/search.json?q=from%3Aaustinonrails&rpp=30&page=1...
Fetching http://search.twitter.com/search.json?q=from%3Aaustinonrails&rpp=30&page=2...
Fetching http://search.twitter.com/search.json?q=from%3Aaustinonrails&rpp=30&page=3...
set([u'damon', u'jbritten', u'bravodeltahotel', u'keithdadkins', u'bilesonline'])
# Fork of http://bazaar.launchpad.net/~mrooney/nutunes/trunk/annotate/head%3A/nutunes.py
# Fetch your top artists from Last.FM and show the most recent Waffles torrents.
# Depends: python >= 2.5, feedparser (python-feedparser in Ubuntu)
from xml.etree import ElementTree as ET
from cookielib import CookieJar, DefaultCookiePolicy
import urllib2, urllib, re, getpass, feedparser
def enable_cookies():
#
# retrieves 10 pages of search json near:austin
#
# usage:
# python populate.py <search term>
#
from pprint import pprint
import simplejson as json
import urllib, urllib2
# To install an application, you may use the command “/opt/Adobe AIR/Versions/1.0/airappinstaller <full path to the air file here>”. Currently relative paths do not work.
from: http://labs.adobe.com/wiki/index.php/AIR_for_Linux:Release_Notes#Application_Installation_.2F_Uninstallation_Details
so, use an absolute path. for example if it's in the current directory:
/opt/Adobe AIR/Versions/1.0/airappinstaller `pwd`/yourapp.air
_imaging.c:ImagingError_Mismatch(void)
libImaging/Antialias.c: return (Imaging) ImagingError_Mismatch();
libImaging/Bands.c: return (Imaging) ImagingError_Mismatch();
libImaging/Blend.c: return ImagingError_Mismatch();
libImaging/Chops.c: return (Imaging) ImagingError_Mismatch();
libImaging/Except.c:ImagingError_Mismatch(void)
libImaging/Geometry.c: return (Imaging) ImagingError_Mismatch();
libImaging/Geometry.c: return (Imaging) ImagingError_Mismatch();
libImaging/Geometry.c: return (Imaging) ImagingError_Mismatch();
libImaging/Geometry.c: return (Imaging) ImagingError_Mismatch();