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
# Update, upgrade and install development tools: | |
apt-get update | |
apt-get -y upgrade | |
apt-get -y install build-essential | |
apt-get -y install git-core | |
# Install rbenv | |
git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv | |
# Add rbenv to the path: |
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 'pp' | |
#require 'ap' # Awesome Print | |
class Object | |
# expects [ [ symbol, *args ], ... ] | |
def recursive_send(*args) | |
args.inject(self) { |obj, m| obj.send(m.shift, *m) } | |
end | |
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
{ | |
"id":"tag:search.twitter.com,2005:181865366610382848", | |
"body":"No one wants to carry laptops any more, but we lose IPads and they are not secure. The Sweden PM ran the country for a week on an ipad.", | |
"verb":"post", | |
"link":"http://twitter.com/ProfNikiEllis/statuses/181865366610382848", | |
"generator":{ | |
"link":"http://twitter.com/#!/download/ipad", | |
"displayName":"Twitter for iPad" | |
}, | |
"postedTime":"2012-03-19T22:10:56.000Z", |
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
{ | |
"id":"tag:search.twitter.com,2005:181865366610382848", | |
"body":"No one wants to carry laptops any more, but we lose IPads and they are not secure. The Sweden PM ran the country for a week on an ipad.", | |
"verb":"post", | |
"link":"http://twitter.com/ProfNikiEllis/statuses/181865366610382848", | |
"generator":{ | |
"link":"http://twitter.com/#!/download/ipad", | |
"displayName":"Twitter for iPad" | |
}, | |
"postedTime":"2012-03-19T22:10:56.000Z", |
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
# Update, upgrade and install development tools: | |
apt-get update | |
apt-get -y upgrade | |
apt-get -y install build-essential | |
apt-get -y install git-core | |
# Install rbenv | |
git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv | |
# Add rbenv to the path: |
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) | |
require 'sinatra' | |
class Api < Sinatra::Application | |
helpers do | |
def protected! | |
unless authorized? | |
response['WWW-Authenticate'] = %(Basic realm="Restricted Area") | |
throw(:halt, [401, "Not authorized\n"]) |
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
module AutoLocale | |
module Helpers | |
def switch_to_lang(lang) | |
lang == options.locales.first ? request.path_info : request.path_info.sub(/^\//, "/#{lang}/") | |
end | |
def has_locale?(url) | |
url =~ /^\/(#{options.locales.join('|')})\/?/ | |
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
require 'capistrano/setup' | |
require 'capistrano/deploy' | |
require 'capistrano/rbenv' | |
require 'capistrano/bundler' | |
require 'capistrano/rails/assets' | |
require 'capistrano/rails/migrations' | |
# Optional | |
require 'capistrano/eye' | |
require 'capistrano/dotgpg' |