Skip to content

Instantly share code, notes, and snippets.

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
# 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
sudo port install beanstalkd
sudo port install memcached
sudo gem install beanstalk-client
sudo gem install memcache-client
# to start
beanstalkd -d
memcached -d
# 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'
#!/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 $*
# 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.
#! /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"
require 'rubygems'
require 'benchmark'
require 'bcrypt'
REPITITIONS = 50
passwords = %w(password)
passwords.each do |password|
puts "Password to hash: #{password}"
source ~/.bash/shortcuts
source ~/.git-completion.sh
function __git_dirty {
git diff --quiet HEAD &>/dev/null
[ $? == 1 ] && echo "!"
}
function __git_branch {
__git_ps1 " %s"
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