Skip to content

Instantly share code, notes, and snippets.

View elazar's full-sized avatar

Matthew Turland elazar

View GitHub Profile
@elazar
elazar / phpunit-log-junit.php
Created May 25, 2012 23:43
PHPUnit --log-junit processor
<?php
/**
* This script is used to process the output of a PHPUnit test run
* that uses --log-junit for the purposes of timing each executed
* test method. It outputs test methods with their respective
* runtimes in order from largest to smallest. Times are in
* seconds. The script accepts paths to any number of files in the
* JUnit log format.
*
* Ex: php phpunit-log-junit.php /path/to/junit-log1.xml /path/to/junit-log2.xml ...
@elazar
elazar / .gitconfig
Created May 1, 2012 18:53
git mem/rec bash aliases
; These aliases are only useful if you work from a directory containing multiple repos.
; mem stores the current branch or commit checked out per repo to a specified file.
; rec reads a specified file in this format and restores the repos to their respective branches or commits.
; This is useful if you're working on or testing multiple branches together and/or simultaneously.
;
; Example:
; git mem /path/to/file
; [change repo configurations, do work, etc.]
; git rec /path/to/file
; [repos are now back in the configuration they were in when git mem was run]
@elazar
elazar / domain.py
Created April 7, 2012 03:12
Python domain checker
#!/usr/bin/env python
import sys
import socket
import itertools
def filter_tlds(x): return x.startswith(".")
tlds = set(filter(filter_tlds, sys.argv[1:]))
non_tlds = set(sys.argv[1:]).difference(tlds)
@elazar
elazar / example.php
Created February 15, 2012 02:54
Delayed route loading in Slim
<?php
require_once 'Slim/Slim.php';
class Custom_Route extends Slim_Route {
public function dispatch() {
$this->setCallable(require $this->getCallable());
return parent::dispatch();
}
}
@elazar
elazar / PasswordIterator.php
Created November 6, 2011 04:55
Iterator to generate sequential passwords within a given length range
<?php
/**
* Iterator to generate sequential passwords within a given length range.
*/
class PasswordIterator implements Iterator
{
/**
* Length of the next password to be generated
* @var int
*/