Skip to content

Instantly share code, notes, and snippets.

View itspriddle's full-sized avatar
🤘
clickity clack

Joshua Priddle itspriddle

🤘
clickity clack
View GitHub Profile
@itspriddle
itspriddle / gist:5406628
Created April 17, 2013 18:34
Installing PHPUnit via PEAR on OS X Mountain Lion
wget http://pear.php.net/go-pear.phar
php -d detect_unicode=0 go-pear.phar
export PATH=$HOME/pear/bin
pear config-set auto_discover 1
pear install --alldeps pear.phpunit.de/PHPUnit
pear install phpunit/dbUnit phpunit/PHPUnit_Selenium phpunit/PHPUnit_Story
@itspriddle
itspriddle / phpunit.rb
Created April 17, 2013 01:56
Install PHPUnit on OS X Mountain Lion using Homebrew
require 'formula'
class Phpunit < Formula
homepage 'http://www.phpunit.de/manual/current/en/index.html'
url 'http://pear.phpunit.de/get/phpunit.phar'
sha1 '7aaa26086ddf7cd0c517d7f52b74a53a7a1d7e29'
version 'HEAD'
def install
bin.install "phpunit.phar" => "phpunit"
# This hosts file is brought to you by Dan Pollock and can be found at
# http://someonewhocares.org/hosts/
# You are free to copy and distribute this file, as long the original
# URL is included. See below for acknowledgements.
# Please forward any additions, corrections or comments by email to
# hosts@someonewhocares.org
# Last updated: Feb 17th, 2013 at 13:37
~ > history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head -20
882 vim
702 git
466 cd
408 ack
241 gco
232 ls
218 rm
129 mv
100 rspec
@itspriddle
itspriddle / gist:4698767
Created February 2, 2013 18:48
This is why you shouldn't use floating points for money in your app
~ > node -e "console.log((0.1 + 0.2) + 0.3 == 0.1 + (0.2 + 0.3))"
false
~ > php -r "var_dump((0.1 + 0.2) + 0.3 == 0.1 + (0.2 + 0.3));"
bool(false)
~ > ruby -e "p (0.1 + 0.2) + 0.3 == 0.1 + (0.2 + 0.3)"
false
~ > python -c "print (0.1 + 0.2) + 0.3 == 0.1 + (0.2 + 0.3)"
#!/usr/bin/env ruby
# Usage:
# gfm <files>
#
# Examples:
#
# gfm README.markdown
# echo "# Test" | gfm
# echo "# Test" | gfm - README.markdown
# gfm
#!/usr/bin/env ruby
#
# Usage: rebundle gem_name
#
# The script will remove the gem dependency tree from the lockfile and bundle.
LOCKFILE_NAME = "Gemfile.lock"
lockfile = File.readlines(LOCKFILE_NAME)
# Always raise errors when I18n translations are missing. To override this
# behavior:
#
# I18n.t :some_key, allow_missing: false
I18n.exception_handler = -> exception, locale, key, options do
if options.delete(:allow_missing)
I18n::ExceptionHandler.new.call(exception, locale, key, options)
else
raise I18n::MissingTranslationData.new(locale, key, options)
end
class Struct
def to_hash
Hash[each_pair.to_a]
end
end
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>