Skip to content

Instantly share code, notes, and snippets.

"""
E=7
TALLET +
SIGNAL
------
ELAINE
"""
letters = set('T A L L E T S I G N A L E L A I N E'.split())
assoc = {letter: None for letter in letters}
<?php
require_once 'PHPUnit/Framework.php';
/**
* Matches a php code string upon a template of tokens
*
* @param string $code String of php code.
* @param string $template See the tests below for examples.
*
* @return array|false Associative array of all variables or false if no match was found
@nb
nb / baba-htaccess
Created March 30, 2010 12:39
Using more than one WordPress codebase for multiple installs without symlinks
RewriteEngine On
RewriteBase /baba/
RewriteRule ^$ ../trunk/$1?_config=baba [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ../trunk/$1?_config=baba [L,QSA]
@nb
nb / copy-playlist-files.py
Created April 17, 2009 16:39
Copy files from an iTunes playlist to a directory
#!/usr/bin/env python
import sys, shutil, os.path
if len(sys.argv) != 3:
sys.stderr.write('Usage: %s PLAYLIST DEST\n\n' % sys.argv[0])
sys.exit(1)
exported, dest = sys.argv[1:]
lines = unicode(open(exported).read(), 'utf16').split('\r')[1:]
files = ['/Volumes/' + line.split('\t')[-1].replace(':', '/') for line in lines]
for file in files:
if os.path.exists(file) and os.path.isfile(file): shutil.copy(file, dest)