This file contains hidden or 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 | |
require 'rubygems' | |
require 'plist' | |
# This is a fix for the bug filed as Radar #1288404 with Apple. | |
# http://openradar.appspot.com/radar?id=1288404 | |
# So, in Snow Leopard, I always set up Mail.app to have keyboard shortucts | |
# for my "From" email addresses. You can create your own in the Keyboard | |
# system preference pane by entering your email address (like "Andre Arko |
This file contains hidden or 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
# Add this code to make sure `gem install` works before `rvm use`. | |
function gem { | |
local result; | |
if [ $1 == "install" ]; then | |
shift; | |
command gem "install" "-n/Library/Ruby/Gems/1.8/bin" "$@"; | |
result="$?"; | |
else | |
command gem "$@"; | |
result="$?"; |
This file contains hidden or 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
# This adds a request header so NewRelic knows when the middleware stack | |
# started processing. Hopefully this means we'll get better metrics, split | |
# between actual request queueing and time spent in the middlewares. | |
module Plex | |
class MiddlewareStart | |
def initialize(app) | |
@app = app | |
end | |
def call(env) |
This file contains hidden or 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
var parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |
This file contains hidden or 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
[alias] | |
# git current-branch => master | |
current-branch = "!git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/^* //'" | |
# git track origin/master => branch master set up to track remote branch origin/master | |
track = "!git branch --set-upstream `git current-branch`" |
This file contains hidden or 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
diff --git a/config/boot.rb b/config/boot.rb | |
index 69b1a51..2c979cf 100644 | |
--- a/config/boot.rb | |
+++ b/config/boot.rb | |
@@ -61,12 +61,30 @@ module Rails | |
require 'initializer' | |
end | |
+ def monkeypatch_helpers | |
+ require "active_support" |
This file contains hidden or 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
namespace :source do | |
def find_and_replace_in_source_files(find, replace) | |
puts "Search and replace #{find.inspect} => #{replace.inspect}" | |
files = %w[ .autotest .rspec .rvmrc Gemfile Procfile config.ru ].select{|f| File.exist?(f) } | |
directories = %w[app config lib public script spec test] # exclude bin, db, doc, log, and tmp | |
directories.each do |d| | |
files += Dir[File.join(d, "**/*.{rb,rake,haml,erb,builder,js,coffee,css,scss}")] | |
end |
This file contains hidden or 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
# make and cd to a directory | |
function mcd { | |
mkdir -p "$@" | |
cd "$@" | |
} |
This file contains hidden or 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
{ | |
"Default": "http://www.google.com/search?q=@@@", | |
"a": "http://www.amazon.com/exec/obidos/search-handle-url/index%3Dblended%26field-keywords%3D@@@", | |
"cl": "http://sfbay.craigslist.org/search/sss?query=@@@", | |
"d": "http://www.demonoid.me/files/?category=0&subcategory=All&quality=All&seeded=0&external=2&query=@@@&uid=0&sort=", | |
"down": "http://downforeveryoneorjustme.com/@@@", | |
"e": "http://search.ebay.com/search/search.dll?satitle=@@@", | |
"f": "http://www.fandango.com/GlobalSearch.aspx?q=@@@", | |
"faq": "http://www.gamefaqs.com/search/index.html?platform=0&s=s&game=@@@", | |
"g": "http://www.google.com/search?q=@@@", |
This file contains hidden or 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 | |
require 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
url = ARGV[0] | |
class Document < Nokogiri::XML::SAX::Document | |
SEMANTIC_CONTAINERS = %w(body article section nav aside hgroup header footer) | |
COUNT_ELEMENTS = %w(p a) |