Skip to content

Instantly share code, notes, and snippets.

@Irio
Irio / gist:1496746
Created December 19, 2011 11:24
Solution for "cannot load such file -- openssl" on RVM
When I tried run "rake test", I received:
rake aborted!
cannot load such file -- openssl
Tasks: TOP => test:units => test:prepare => db:test:prepare => db:abort_if_pending_migrations => environment
(See full trace by running task with --trace)
@Irio
Irio / gist:1835757
Created February 15, 2012 13:45
Solution for "Failed to build gem native extension" with capybara-webkit on Ubuntu
$ bundle install
Fetching source index for http://rubygems.org/
Using rake (0.9.2.2)
Using ZenTest (4.6.2)
Using RubyInline (3.11.1)
Using sexp_processor (3.0.10)
Using ParseTree (3.0.8)
Using multi_json (1.0.4)
Using activesupport (3.1.3)
Using builder (3.0.0)
@Irio
Irio / gist:1886102
Created February 22, 2012 17:07
Solution for "undefined method `today' for Date:Class" on Ruby
1.9.2-p290 :001 > Date.today
NoMethodError: undefined method `today' for Date:Class
from (irb):1
from /home/irio/.rvm/rubies/ruby-1.9.2-p290/bin/irb:16:in `<main>'
1.9.2-p290 :002 > require 'date'
=> true
1.9.2-p290 :003 > Date.today
=> #<Date: 2012-02-22 (4911959/2,0,2299161)>
@Irio
Irio / gist:1951660
Created March 1, 2012 17:50
PostgreSQL 9.1.3 on Ubuntu 11.10
$ sudo apt-get install postgresql libpq-dev postgresql-contrib
$ sudo -u postgres createuser desired_user
$ cd /etc/init.d/
$ sudo -u postgres psql template1
template1=# ALTER USER desired_user WITH PASSWORD 'desired_password';
@Irio
Irio / gist:1952342
Created March 1, 2012 19:06
Create a git branch just until a certain commit
# First of all, get the commit's hash. Then...
$ git branch new_branch_name c06d29d2ae420ade7adce4f7489c7b4f96694eb4
@Irio
Irio / gist:1960872
Created March 2, 2012 19:53
Git clone remote branch to a new local branch
$ git fetch RemoteName
$ git checkout RemoteName/branch_name
$ git checkout -b RemoteName_branch_name
@Irio
Irio / gist:1974023
Created March 4, 2012 17:33
Setup PostgreSQL on Fedora 16
# install server
[youruser@host]$ sudo yum install postgresql-server
# set password
[youruser@host]$ sudo passwd postgres
# create cluster
[youruser@host]$ sudo mkdir -p /usr/local/pgsql/
[youruser@host]$ sudo chown postgres /usr/local/pgsql/
[youruser@host]$ su postgres
@Irio
Irio / gist:2176969
Created March 24, 2012 01:13
Copying files through network using scp
## One file
$ scp my_file_name.mp3 user@ip:/home/user/destination/folder
## More than one file
# Pattern
$ scp *.mp3 user@ip:/home/user/destination/folder
@Irio
Irio / db.rake
Created April 25, 2012 19:52
db:dump_data and db:load_data
#largely based on http://devblog.michaelgalero.com/2008/11/03/custom-rake-tasks-in-merb-data-import/
require 'rake'
ENV['ENVIRONMENT'] = 'test' if ENV['ENVIRONMENT'].nil?
# DB tasks
namespace :db do
require 'dm-core'
require 'dm-types'
@Irio
Irio / gist:2653897
Created May 10, 2012 15:25
tag-it.js
// Comma/Space/Enter are all valid delimiters for new tags,
// except when there is an open quote or if setting allowSpaces = true.
// Tab will also create a tag, unless the tag input is empty, in which case it isn't caught.
if (
event.which == $.ui.keyCode.COMMA ||
event.which == $.ui.keyCode.ENTER ||
(
event.which == $.ui.keyCode.TAB &&
that._tagInput.val() !== ''
) ||