Skip to content

Instantly share code, notes, and snippets.

View paltman's full-sized avatar

Patrick Altman paltman

View GitHub Profile
@paltman
paltman / Capfile
Created July 27, 2008 04:10 — forked from trey/Capfile
set :application, "clever_name"
set :user, "deploy"
set :scm_username, "you"
set :repository, "git@github.com:#{scm_username}/#{application}.git"
set :deploy_to, "/var/www/apps/#{application}"
set :scm, :git
set :django_location, "/usr/local/django/trunk"
set :django_admin_media, "/django/contrib/admin/media"
set :domain, "example.com"
@paltman
paltman / pylink.sh
Created November 21, 2008 21:52 — forked from zvoase/pylink.sh
added a check for empty SITE_PACKAGES variable
class kewlness(object):
def __init__(self, func):
self.func = func
def __call__(self, *args, **kwargs):
if len(args) > 0:
self.new_thing = args[0]
return self.func(*args, **kwargs)
def __repr__(self):
return self.func.__doc__
@paltman
paltman / pylink.sh
Created February 28, 2010 05:19 — forked from zvoase/pylink.sh
Hosting Sphinx docs at GitHub
-----------------------------
Before: Run sphinx-quickstart in docs/
1. Follow "Project Pages" instructions from http://pages.github.com/ to create a gh-pages branch
2. Add Sphinx html build dir as git submodule:
git checkout master
git submodule add -b gh-pages git@github.com:arthurk/django-disqus.git docs/_build/html
#!/usr/bin/env python
"""
A script to query the Amazon Web Services usage reports programmatically.
Ideally this wouldn't exist, and Amazon would provide an API we can use
instead, but hey - that's life.
Basically takes your AWS account username and password, logs into the
website as you, and grabs the data out. Always gets the 'All Usage Types'
def elem2dict(node):
"""
Convert an lxml.etree node tree into a dict.
"""
d = {}
for e in node.iterchildren():
key = e.tag.split('}')[1] if '}' in e.tag else e.tag
value = e.text if e.text else elem2dict(e)
d[key] = value
return d
@paltman
paltman / translate.py
Created August 31, 2011 22:52 — forked from rizumu/translate.py
translate
"""A management command for extracting translation messages for the whole project."""
import glob
import os
from django.conf import settings
from django.core.management.base import NoArgsCommand
class Command(NoArgsCommand):
@paltman
paltman / gist:2470362
Created April 23, 2012 11:40
Sample HTML page with Twitter's Bootstrap, Ryan Fait's Sticky Footer, and a full-width footer
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="author" content="Martin Bean" />
<title>Twitter&rsquo;s Bootstrap with Ryan Fait&rsquo;s Sticky Footer</title>
<link rel="stylesheet" href="https://raw.github.com/twitter/bootstrap/master/docs/assets/css/bootstrap.css" />
<style>
html, body {
height: 100%;
@paltman
paltman / README.md
Created March 18, 2013 00:41 — forked from mbostock/.block

This examples demonstrates how to use D3's brush component to implement focus + context zooming. Click and drag in the small chart below to pan or zoom.