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
# Example of making sure that multibyte characters are counted | |
# properly with regard to APIs such as Twitter. | |
# | |
# See http://dev.twitter.com/pages/counting_characters | |
# | |
# Uses example from above link: | |
# cafe (with diacritical): | |
# 0x63 0x61 0x66 0xC3 0xA9 (composed character) | |
# 0x63 0x61 0x66 0x65 0xCC 0x81 (e + combining diacritical) |
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
#!/bin/bash | |
# | |
# usat_import | |
# Fork by Mike Tigas | |
# Based on work by Ryan Nagle, Chris Groskopf and Brian Boyer | |
# | |
# Updated to allow import of multiple states into the same database. | |
# Unlike the original script, this *only* generates super-wide tables. | |
# | |
# Shapes are stored in WGS84 (EPSG:4326) for portability. |
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
require 'formula' | |
require 'hardware' | |
class Pypy < Formula | |
if MacOS.prefer_64_bit? | |
url 'http://buildbot.pypy.org/nightly/trunk/pypy-c-jit-42951-88b090e851cc-osx64.tar.bz2' | |
md5 'f2fc482e8de56171f05ad83d92846acf' | |
version '1.5.0a' | |
else | |
url 'http://pypy.org/download/pypy-1.4.1-osx.tar.bz2' |
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 Django middleware, to aid in implementing the HTTP header-based | |
"Do Not Track" mechanism described in [1] and a few of the myriad variations. | |
Known browsers utilizing this option include Firefox 4+, Internet Explorer 9+, | |
and Safari under Mac OS X 10.7. | |
This does nothing by itself. It remains the application's responsibility to | |
ensure that the `tracking_opt_out` attribute is used to toggle first party | |
tracking and disable or notify third parties of the user's preference. |
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 sys | |
def getint(data, offset, intsize): | |
"""Retrieve an integer (big-endian) and new offset from the current offset""" | |
value = 0 | |
while intsize > 0: | |
value = (value<<8) + ord(data[offset]) | |
offset = offset + 1 | |
intsize = intsize - 1 |
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 django.utils.html import strip_spaces_between_tags | |
class SpacelessHtmlResponse(object): | |
""" | |
Equivalent to running {% spaceless %} template tag against a full HTML response. | |
""" | |
def process_response(self, request, response): | |
if response.get("Content-Type", "").startswith("text/html"): | |
response.content = strip_spaces_between_tags(response.content.strip()) | |
return response |
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
# Add to .bash_profile: | |
# Adds `slow_net` and `slow_net_off` commands to your terminal. | |
# * limits to 150KBps ~~ 1.2 Megabit internet | |
# * adds 200ms latency | |
alias slow_net="sudo ipfw pipe 1 config bw 150KByte/s delay 200ms && sudo ipfw add 1 pipe 1 src-port 80" | |
alias slow_net_off="sudo ipfw delete 1" |
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
# Check out the base Django trunk into "django" directory. | |
svn co http://code.djangoproject.com/svn/django/trunk/ django | |
# ... update it to 1.2.5 | |
svn switch http://code.djangoproject.com/svn/django/tags/releases/1.2.5/ django | |
# ... update to 1.3 | |
svn switch http://code.djangoproject.com/svn/django/tags/releases/1.3/ django |
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
Under 5 years,under_5_yrs,dpsf0010002 | |
5 to 9 years,5_to_9_yrs,dpsf0010003 | |
10 to 14 yrs,10_to_14_yrs,dpsf0010004 | |
15 to 19 yrs,15_to_19_yrs,dpsf0010005 | |
20 to 24 yrs,20_to_24_yrs,dpsf0010006 | |
25 to 29 yrs,25_to_29_yrs,dpsf0010007 | |
30 to 34 yrs,30_to_34_yrs,dpsf0010008 | |
35 to 39 yrs,35_to_39_yrs,dpsf0010009 | |
40 to 44 yrs,40_to_44_yrs,dpsf0010010 | |
45 to 49 yrs,45_to_49_yrs,dpsf0010011 |
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
class A(object): | |
def __init__(self): | |
print "A init" | |
class B(A): | |
def __init__(self): | |
print "B init" | |
super(B, self).__init__() | |
class C(B): |