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 | |
from itertools import izip, tee | |
from sys import argv, exit | |
def pairwise(iter): | |
# See: http://docs.python.org/library/itertools.html#recipes | |
a, b = tee(iter) | |
next(b, None) | |
return izip(a, b) |
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 bash | |
START=2 | |
STOP=300 | |
lastprime=2 | |
primes=$(wget -O - -q http://www.math.utah.edu/~alfeld/math/p10000.html \ | |
| cut -c8- \ | |
| egrep -o '^ [0-9 ]+$' \ | |
| awk '{ list = list $0 } END { print list }') |
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
time curl -s http://www.gstatic.com/s2/sitemaps/sitemap-[001-002].txt \ | |
| xargs -P10 -L1 -I{} sh -c "curl -s {} | egrep -o 'profiles.google.com/[^&\"]+' | cut -d'/' -f2 | egrep -v '^[0-9]+$'" |
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
RewriteEngine On | |
# Rewrite all URLs with md5 cachebusting | |
# e.g. /e0d97534e77671a12012a9a1effc3bda/css/style.css -> /css/style.css | |
RewriteRule ^[A-Z0-9]{32}/(.*)$ $1 [NC,N] | |
# Based on the Zend Framework manual | |
# see: http://framework.zend.com/manual/1.11/en/project-structure.rewrite.html | |
RewriteCond %{REQUEST_FILENAME} -s [OR] | |
RewriteCond %{REQUEST_FILENAME} -l [OR] |
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
<?php | |
$input = <<<EOF | |
### Section: Imports ### | |
text.... | |
foo | |
### End Section ### |
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/sh | |
if [ $# -ne 1 ]; then | |
echo "usage: $0 TEST-DIR" | |
exit 1 | |
fi | |
testsDir=$1 | |
if [ ! -d $testsDir ]; then |
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
-- | |
-- First we create the table with charset=utf8 | |
-- | |
mysql> create table utf8 (msg varchar(10)) default charset=utf8; | |
Query OK, 0 rows affected (0.00 sec) | |
-- | |
-- This is out demo-character (remember the hex value!) | |
-- |
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
create table bla( | |
b int, | |
id int not null auto_increment, | |
primary key (b, id), | |
unique key (id) | |
) engine=innodb; | |
insert into bla (b) values (1), (2), (1), (2); | |
/* this looks like "order by id, b" because with small tables mysql doesn't use the primary key */ |
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
$ -> | |
# === CONFIGURATION | |
GAME_DIV_ID = '#game' | |
FAYE_URL = 'http://localhost:9292/faye' | |
# === APPLICATION | |
GameModel = Backbone.Model.extend {} | |
GameView = Backbone.View.extend { | |
el: $(GAME_DIV_ID) |
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
<?php | |
class SomeFixture extends CakeTestFixture | |
{ | |
public $name = 'Table'; | |
public $records = array( | |
array('A' => 1, 'B' => 2), | |
array('B' => 2, 'A' => 1) | |
); | |
} |
OlderNewer