Ruby Enterprise Edition and Passenger ./script/console production fails and instead returns Loading production environment (Rails 2.3.5) Rails requires RubyGems >= 1.3.2. Please install RubyGems and try again: http://rubygems.rubyforge.org
After installing Ruby Enterprise Edition, REE, and Passenger on Ubuntu you may see this error message when you run script/console for the first time
./script/console production
# =>
Loading production environment (Rails 2.3.5)
Rails requires RubyGems >=...
Written by Sean Behan on 06/17/2012
How to Create a Date Time Snippet in Sublime Text 2 (Dynamic Signature with Time Stamp)
You'll have to create a new plugin. From the menu bar select
Tools > New Plugin
Copy the Python script from the signature.py file. Remember to replace your email address (it's example.com).
Save the file, signature.py, is fine. Next open up Prefer...
Written by Sean Behan on 06/17/2012
Cool Conditional Syntax in Ruby (on Rails)
Ruby is beautiful
@posts =
if true
Post.all
else
[]
end
Simply elegant!
Written by Sean Behan on 06/17/2012
How To Get A List of All Registered Mime Types in Rails
When mime types are registered they are placed in a hash constant EXTENSION_LOOKUP in the module Mime. For reference, the file with the relevant code is in rails/action_pack/lib/action_dispatch/http/mime_type.rb available on Github at https://github.com/r...
Written by Sean Behan on 06/17/2012
How to Extract the Title From an HTML Page with Ruby
This snippet will make a request to this page and extract the title from the title tag.
require 'open-uri'
html = open('http://www.seanbehan.com/how-to-extract-the-title-from-an-html-page-with-ruby').read
title = html.match(/(.*)/) { $1 }
pu...
Written by Sean Behan on 08/22/2013