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.
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
set :application, "clever_name" | |
set :user, "deploy" | |
set :scm_username, "you" | |
set :repository, "[email protected]:#{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" |
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 | |
# If there is not already a SITE_PACKAGES environment variable, then get it | |
# from Python. | |
if [[ -z $SITE_PACKAGES || ! -d $SITE_PACKAGES ]] | |
then | |
SITE_PACKAGES=`python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"` | |
fi | |
# Parse the first argument |
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 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__ |
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 | |
# | |
# pylink.sh - Link a Python module to your site packages directory. | |
# | |
# See http://gist.github.com/21649 for updates. | |
# Check that an argument has been given. If not, print usage string. | |
if [ -z $1 ] | |
then | |
echo "Usage: `basename $0` <path_to_module> [<link_name>]" |
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
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 [email protected]:arthurk/django-disqus.git docs/_build/html |
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 | |
""" | |
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' |
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
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 |
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 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): |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<meta name="author" content="Martin Bean" /> | |
<title>Twitter’s Bootstrap with Ryan Fait’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%; |
OlderNewer