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
case request.format | |
when :html then render | |
when :js then render | |
else head(:not_supported) | |
end | |
# vs | |
respond_to do |format| | |
format.html |
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
class Poller < Rails::Metal | |
def process(env) | |
if env["PATH_INFO"] =~ /^\/poller_rack/ | |
return [200, {"Content-Type" => "text/html"}, ["Hello, World!"]] | |
end | |
end | |
end | |
# Implementation: |
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
#!/bin/sh | |
# git-create-remote-branch <branch_name> | |
if [ $# -ne 1 ]; then | |
echo 1>&2 Usage: $0 branch_name | |
exit 127 | |
fi | |
set branch_name = $1 | |
git push origin origin:refs/heads/${branch_name} |
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
def root(*args) | |
if defined?(RAILS_ROOT) | |
args.compact.empty? ? RAILS_ROOT : File.join(RAILS_ROOT, args) | |
end | |
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
config.action_controller.asset_host = Proc.new do |source, request| | |
non_ssl_host = "http://asset#{source.hash % 4}.backpackit.com" | |
ssl_host = "https://asset1.backpackit.com" | |
if request.ssl? | |
case | |
when source =~ /\.js$/ | |
ssl_host | |
when request.headers["USER_AGENT"] =~ /(Safari)/ | |
non_ssl_host |
NewerOlder