Build Your Own Calendar in Rails without any Plugins in less than 10 lines of Ruby Code
There are a number of terrific calendar plugins for Rails. But it's almost as easy, if not easier, to implement your own calendar.
The steps are pretty simple. First get the @beginning_of_month and @end_of_month and iterate over the days in between. In t...
Written by Sean Behan on 06/17/2012
Override to_param method in model to get pseudo permalinks without any work
There are a number of permalink plugins for Rails, http://www.seoonrails.com/even-better-looking-urls-with-permalink_fu, is a good one that I've used before. However, this involves informing the model class (has_permalink :title), adding a route, using t...
Written by Sean Behan on 06/17/2012
Date and Time Helpers in Rails
Just for reference http://api.rubyonrails.org/classes/ActionView/Helpers/DateHelper.html#M001695
This post was created about ago
Written by Sean Behan on 06/17/2012
Installing Scala on Mac OS X Leopard
I followed the instructions from here http://arvinderkang.com/2009/09/01/installing-scala-on-snow-leopard/ but I used version 2.7.6 (rather than .5) I installed scala under /usr/local/scala so I had to include it to my path. Type
vim .bash_profile
expor...
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
Acts_as_versioned Rails Plugin
Versioning models with the acts_as_versioned plugin
cd rails/app
./script/plugin install git://github.com/technoweenie/acts_as_versioned.git
./script/generate model post title:string body:text
In your model
class Post < ActiveRecord::Base
acts_as_ve...
Written by Sean Behan on 06/17/2012
Install MySQLdb for Python on Mac OS X
I don't do much python development. I really like the language and there are a lot of great software projects out there for it. Tornado, for example, is a fast non-blocking web server in python, just open sourced by Facebook that is the engine behind Frie...
Written by Sean Behan on 06/17/2012
Regular Expression for finding absolute URLs
Regular Expression for finding absolute URLs in a bunch of text... like a log file.
/(http:(.*?)\s)/
Written by Sean Behan on 06/17/2012
Non Standard Port Number with SSH and Git
Here is an example using the port 4567 to connect with over ssh and git
ssh remote add origin ssh://sean@seanbehan.com:4567/path/to/git
git push origin master
Written by Sean Behan on 06/17/2012
Manage Fixtures with Yaml DB Plugin for Rails
Get the plugin like so...
script/plugin install git://github.com/adamwiggins/yaml_db.git
This command will dump your data
rake db:data:dump
And load it back
rake db:data:load
Beautiful :) More info here
http://blog.heroku.com/archives/2007/11/23/yam...
Written by Sean Behan on 06/17/2012