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
def call(env) | |
@metals.keys.each do |app| | |
result = app.call(env) | |
return result unless result[0].to_i == 404 | |
end | |
@app.call(env) | |
end |
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
# Allow the metal piece to run in isolation | |
require(File.dirname(__FILE__) + "/../../config/environment") unless defined?(Rails) | |
class Test | |
def self.call(env) | |
if env["PATH_INFO"] =~ /^\/test/ | |
[200, {"Content-Type" => "text/html"}, ["Hello, World!"]] | |
else | |
[404, {"Content-Type" => "text/html"}, ["Not Found"]] | |
end |
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
sudo port install beanstalkd | |
sudo port install memcached | |
sudo gem install beanstalk-client | |
sudo gem install memcache-client | |
# to start | |
beanstalkd -d | |
memcached -d |
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
# Export old iphone address book backup to vcards so you can reimport. | |
# Use a tool like the Backup extractor (http://supercrazyawesome.com/) | |
# to get the backup created, then grab Library/AddressBook/AddressBook.sqlitedb | |
# and AddressBookImages.sqlitedb. Put them in this directory. | |
# | |
# Requires sqlite3 gem and vpim gem | |
# Usage: ruby export.rb > filename.vcf | |
require 'rubygems' | |
require 'sqlite3' |
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/bash | |
export PATH="/opt/rubyee/bin:/opt/local/bin:/opt/local/sbin:/opt/local/lib/postgresql83/bin/:/usr/local/bin:/usr/local/sbin:~/.bin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin" | |
/opt/rubyee/bin/ruby $* |
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
# Find and replace in textmate to fix merge conflicts. | |
# As shown this takes the second capture group | |
# | |
# <<<<<<< HEAD:2983fjasd | |
# code1 | |
# ======= | |
# code2 | |
# >>>>>>> master:2983rfja9sd | |
# | |
# As shown, this find and replace will take code 2. |
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 ruby | |
# | |
# Save in your path as "isreg" and chmod +x. Then: isreg domain.com | |
# | |
puts `whois #{ARGV[0]}` =~ /No match for \"#{ARGV[0]}\"/mi ? "No" : "Yes" |
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
require 'rubygems' | |
require 'benchmark' | |
require 'bcrypt' | |
REPITITIONS = 50 | |
passwords = %w(password) | |
passwords.each do |password| | |
puts "Password to hash: #{password}" |
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
source ~/.bash/shortcuts | |
source ~/.git-completion.sh | |
function __git_dirty { | |
git diff --quiet HEAD &>/dev/null | |
[ $? == 1 ] && echo "!" | |
} | |
function __git_branch { | |
__git_ps1 " %s" |
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
http://antirez.com/post/autocomplete-with-redis.html | |
http://praegnanz.de/html5video/ | |
http://briancray.com/2010/09/08/html5-microdata/ | |
http://diveintohtml5.org/extensibility.html | |
http://www.quirksmode.org/blog/archives/2010/09/testing_blackbe.html | |
http://intridea.com/2010/9/13/a-web-developer-goes-native-with-android | |
http://nvie.com/posts/how-i-boosted-my-vim/ | |
http://onebuttonmouse.com/ramblings/domainbrain-2-0-is-now-available/ | |
http://www.tuttoaster.com/ruby-for-php-developers/ | |
http://blog.brandonbloom.name/2010/09/how-two-pythonistas-accidentally-fell.html |