Skip to content

Instantly share code, notes, and snippets.

Geoff Catlin gcatlin

View GitHub Profile
@gcatlin
gcatlin / phpunit.xml
Created Jan 21, 2013
Print slowest PHPUnit tests
View phpunit.xml
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
printerClass="ProfilerPrinter"
printerFile="profiler.php"
>
</phpunit>
@gcatlin
gcatlin / composer.json
Last active Dec 11, 2015
Add dependency on a github project that doesn't support Composer.
View composer.json
{
"name": "my-github-username/my-project-name",
"description": "Project description goes here",
"repositories": {
"other-github-username/other-github-project-name": {
"type": "package",
"package": {
"name": "other-github-username/other-github-project-name",
"version": "dev-master",
View BaseDecorator.php
<?php
class BaseDecorator {
private $component;
private $methods = array();
private $properties = array();
public function __construct($component) {
$this->component = $component;
}
@gcatlin
gcatlin / gist:3811614
Created Oct 1, 2012
brew upgrade vim 7.3.672 failure
View gist:3811614
$ brew doctor
Your system is raring to brew.
$ brew -v upgrade
Homebrew 0.9.3
==> Upgrading vim
==> Cloning https://vim.googlecode.com/hg/
Updating /Library/Caches/Homebrew/vim--hg
/usr/local/bin/hg pull
warning: vim.googlecode.com certificate with fingerprint af:26:ef:84:56:0d:c7:67:a8:86:8b:58:38:44:51:96:e4:90:bd:b2 not verified (check hostfingerprints or web.cacerts config setting)
@gcatlin
gcatlin / summarize.php
Created Sep 21, 2012
crappy ab output parser
View summarize.php
<?php
$files = array_slice($argv, 1);
echo "[cache],[concurrency_level],[time],[requests],[failures],[requests_per_second],[time_per_request],[concurrent_time_per_request],[transfer_rate],[p50],[p66],[p75],[p80],[p90],[p95],[p98],[p99],[max]\n";
foreach ($files as $file) {
if (in_array(array('run', 'summarize.php'), $files)) {
continue;
}
@gcatlin
gcatlin / ncurses.diff
Created Jul 12, 2012
Homebrew Ncurses clang patch
View ncurses.diff
diff --git a/ncurses.rb b/ncurses.rb
index 1067083..8cc12bc 100644
--- a/ncurses.rb
+++ b/ncurses.rb
@@ -23,4 +23,9 @@ class Ncurses < Formula
system "make"
system "make install"
end
+
+ def patches
@gcatlin
gcatlin / gist:2989928
Created Jun 25, 2012
Django middleware for handling non-multipart uploads
View gist:2989928
class ApplicationOctetStreamHandlerMiddleware():
def process_request(self, request):
# @TODO support base64 encoding
# @TODO support content-disposition header and filename
content_type = request.META.get('CONTENT_TYPE')
try:
content_length = int(request.META.get('CONTENT_LENGTH', 0))
except (ValueError, TypeError):
content_length = 0
@gcatlin
gcatlin / gist:1897059
Created Feb 24, 2012
Set short keyboard delay and fast repeat rate on OS X
View gist:1897059
# Source: http://quickies.seriot.ch/index.php?id=411
defaults write NSGlobalDomain InitialKeyRepeat -int 7
defaults write NSGlobalDomain KeyRepeat -int 0
@gcatlin
gcatlin / gist:1847248
Created Feb 16, 2012
Install specific version of Homebrew formula
View gist:1847248
brew update
brew versions FORMULA
cd `brew --prefix`
git checkout HASH Library/Formula/FORMULA.rb # use output of "brew versions"
brew install FORMULA
brew switch FORMULA VERSION
git checkout -- Library/Formula/FORMULA.rb # reset formula
## Example: Using Subversion 1.6.17
#
@gcatlin
gcatlin / gist:1845095
Created Feb 16, 2012
Convert audio files - m4a to mp3
View gist:1845095
# source: http://stackoverflow.com/a/5057305
# finds all the files in the current directory, converts them to mp3, using
# the original file name and changing the file extension
find . | parallel ffmpeg -i {} -ab 192k -acodec libmp3lame -ac 2 {.}.mp3
You can’t perform that action at this time.