How to Use RVM and POW with Ruby 2.0.0
In your project's root directory add a .ruby-version file and add the ruby version to the file
ruby-2.0.0-p247
Next source RVM in the .powrc file, also in your project's root directory.
source "$rvm_path/scripts/rvm"
rvm use `cat .ruby-versio...
Written by Sean Behan on 10/19/2013
How to Make Cross Database Queries with Postgres and DBLink Extension
Here are a few snippets for cross database queries. It's important to note that you must be explicit in enumerating the columns and types you are querying. Otherwise, things will probably not work as expected.
-- enable extension
create extension db...
Written by Sean Behan on 03/18/2017
Recursively Zip a Directory and Files on Linux
It's Short and sweet!
Just remember that the finished zip filename is the first argument and the directory you wish to recursively zip comes after.
zip -r name_of_your_directory.zip name_of_your_directory
That's all.
You might be intere...
Written by Sean Behan on 03/05/2017
Highlight String in PHP
Function for highlighting text/strings in PHP.
$content = file_get_contents("http://php.net/");
print highlight("PHP", $content);
function highlight($match, $string){
return str_ireplace($match, "<span style='background:yellow'>$match</span&...
Written by Sean Behan on 06/17/2012
named_scope in Rails
Take advantage of the named_scope method in your models and make find queries simple and beautiful!
#app/models/comment.rb
class Comment < ActiveRecord::Base
belongs_to :post
named_scope :pending, :conditions => ["pending = ?", true]
named_scope :...
Written by Sean Behan on 06/17/2012