Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
 
        | <?php | |
| class AbstractManagerBase extends \PHPUnit_Framework_TestCase | |
| { | |
| protected function getEmMock() | |
| { | |
| $emMock = $this->getMock('\Doctrine\ORM\EntityManager', | |
| array('getRepository', 'getClassMetadata', 'persist', 'flush'), array(), '', false); | |
| $emMock->expects($this->any()) | |
| ->method('getRepository') | 
| LIBEXECDIR=/usr/libexec/apache2 | 
| location ^~ /attachments/download_zip/ { | |
| proxy_pass http://mongrel; | |
| proxy_redirect off; | |
| proxy_set_header Host $host; | |
| proxy_set_header X-Real-IP $remote_addr; | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
| proxy_set_header X_Forwarded_Proto $scheme; | |
| proxy_read_timeout 120; | |
| proxy_connect_timeout 120; | |
| post_action @notify_zip | 
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| #!/bin/bash | |
| # virtualenv-auto-activate.sh | |
| # | |
| # Installation: | |
| # Add this line to your .bashrc or .bash-profile: | |
| # | |
| # source /path/to/virtualenv-auto-activate.sh | |
| # | |
| # Go to your project folder, run "virtualenv .venv", so your project folder | |
| # has a .venv folder at the top level, next to your version control directory. | 
| # You will need to make this file executable (chmod u+x) and run it with sudo | |
| apt-get update | |
| apt-get --fix-missing -y install build-essential m4 libncurses5-dev libssh-dev unixodbc-dev libgmp3-dev libwxgtk2.8-dev libglu1-mesa-dev fop xsltproc default-jdk | |
| mkdir -p /src/erlang | |
| cd /src/erlang | |
| wget http://www.erlang.org/download/otp_src_R15B01.tar.gz | |
| tar -xvzf otp_src_R15B01.tar.gz | |
| chmod -R 777 otp_src_R15B01 | |
| cd otp_src_R15B01 | |
| ./configure | 
| This playbook has been removed as it is now very outdated. | 
I run a lot of web servers for different projects, all of them on different ports. Generally I start with port 8000 and increment from there as I spin up new servers, but it became tiresome to remember what projects were running on which ports and what the next available port was.
/etc/hosts won't let you specify a port, but a combination of aliasing 127.0.0.1 to 127.0.0.X, forwarding ports from 8000 to 80, and adding the 127.0.0.X IP under an alias in /etc/hosts did work.
This script finds the next available value of X, aliases it with ifconfig, forwards the given port to port 80 with ipfw, and adds a new entry to /etc/hosts that aliases the IP to the domain you want.
Now I can add a server alias with sudo domain-alias funproject 8000, run the web server at 127.0.0.X:8000, and load up http://funproject/ in my browser.
(Because I needed it to work on a Mac, I couldn't use iptables. pfctl seems to work.)
Locate the section for your github remote in the .git/config file. It looks like this:
[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git
Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: