Skip to content

Instantly share code, notes, and snippets.

View statico's full-sized avatar

Ian Langworth ☠ statico

View GitHub Profile
@statico
statico / settings_local.py
Created March 29, 2011 18:29
Additions to settings_local.py
# Change these to your libgeos paths!
GEOS_LIBRARY_PATH = '/opt/local/lib/libgeos_c.dylib'
GDAL_LIBRARY_PATH = '/opt/local/lib/libgdal.dylib'
GEOIP_LIBRARY_PATH = '/opt/local/lib/libGeoIP.dylib'
GEOIP_PATH = '/opt/local/share/GeoIP/'
# Disable compression if you need to debug JavaScript. You need to set both.
COMPRESS = False
ASSETS_DEBUG = True
for url in re.findall(r'(https?://\S+)', content):
# Ignore boring urls
if not url.startswith('http://www.youtube.'):
return
ALTER TABLE events ENGINE=INNODB;
ALTER TABLE invites ENGINE=INNODB;
ALTER TABLE media_urls ENGINE=INNODB;
ALTER TABLE membership ENGINE=INNODB;
ALTER TABLE migrate_version ENGINE=INNODB;
ALTER TABLE queue ENGINE=INNODB;
ALTER TABLE rooms ENGINE=INNODB;
ALTER TABLE users ENGINE=INNODB;
@statico
statico / html5gamesde.py
Created June 26, 2011 08:08
Replacing Yahoo! Pipes with Python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import datetime
import htmllib
import urllib
import PyRSS2Gen
from BeautifulSoup import BeautifulSoup
// Copyright 2011 Google Inc. All Rights Reserved.
/* Swiffy runtime version 1.0 */
var f = void 0,
h = null,
j = Object,
k = document,
l = Math,
m = Array,
aa = Error,
ba = parseInt,
@statico
statico / chat.html
Created July 17, 2011 01:11
PubNub Example Chat
<div><input id=input placeholder=you-chat-here /></div>
<div id=box></div>
<div id=pubnub pub-key=demo sub-key=demo></div>
<script src=http://cdn.pubnub.com/pubnub-3.1.min.js></script>
@statico
statico / ssh-agent.sh
Created August 8, 2011 21:47
Starting an ssh-agent once and restoring the session later. A really lightweight version of the `keychain` script.
# A function which restarts the ssh-agent, saves the output to a file which can
# be sourced later, and adds the default ssh key.
sshenv=$HOME/.sshlocal
function init-ssh-agent() {
# Kill the agent if it's running.
if [ -n "$SSH_AGENT_PID" ]; then
echo "Killing existing agent $SSH_AGENT_PID..."
kill $SSH_AGENT_PID
fi
# Run the agent and add the key.
@statico
statico / airbnb.js
Created September 15, 2011 01:52
airbnb's nifty search scrolling uses onscroll event
var m, j;
var l = jQuery("#search_filters");
var c = jQuery("#search_body");
var p = l.position().top;
var k = l.height();
function n() {
var s = jQuery(window).scrollTop();
var r = l.position().top;
if ((s >= p) && (k < j)) {
@statico
statico / assets.py
Created September 28, 2011 18:24
Bundle generators for use with webassets
from django.conf import settings
from django_assets import Bundle, register
from webassets.filter import get_filter
def js(name, *args, **kwargs):
"""
Convenience helper for creating JavaScript bundles.
Given a `name`, this function registers a bundle named `name +
"_js"` with default filters. The output file will prefixed with
@statico
statico / assets2.py
Created September 28, 2011 22:10
Assets template tag
# We currently use webassets for asset bundling. Unfortunately it
# requires you to write lengthy tag definitions in HTML:
#
# {% load assets %}
# {% assets "foo_js", "bar_js" %}
# <script type="text/javascript" src="{{ ASSET_URL }}"></script>
# {% endassets %}
#
# This tag simplifes the above:
#