Skip to content

Instantly share code, notes, and snippets.

View eddorre's full-sized avatar

Carlos Rodriguez eddorre

View GitHub Profile
robby-russells-macbook-pro% sudo /opt/local/bin/port selfupdate
MacPorts base version 1.600 installed
Downloaded MacPorts base version 1.600
The MacPorts installation is not outdated and so was not updated
selfupdate done!
.transparent
{
filter:alpha(opacity=60);
-moz-opacity: 0.6;
opacity: 0.6;
}
I use Cucumber 0.3.97. Your mileage may vary with older versions.
# Install guillaumegentil's RSpactor gem
sudo gem install guillaumegentil-rspactor
# Change your database.yml to include the following
test: &TEST
database: your_database_name_here
<<: *login
#!/usr/bin/env ruby
puts "looking for the gems to upgrade..."
gem_info = Struct.new(:name, :version)
to_reinstall = []
Dir.glob('/Library/Ruby/Gems/**/*.bundle').map do |path|
path =~ /.*1.8\/gems\/(.*)-(.*?)\/.*/
name, version = $1, $2
bundle_info = `file path`
to_reinstall << gem_info.new(name, version) unless bundle_info =~ /bundle x86_64/
end
@eddorre
eddorre / Ruby Idioms
Created September 18, 2009 06:18 — forked from kblake/Ruby Idioms.rb
#RUBYISMS
a = b.foo
if a.empty?
a = b.bar
else
a.reverse!
end
#can be simplied a little by assigning and
function migrate() {
if [[ $1 == '' ]]; then
rake db:migrate RAILS_ENV=development && rake db:migrate RAILS_ENV=test
else
rake db:migrate RAILS_ENV=$1
fi
}
function rollback() {
if [[ $1 == '' ]]; then
Using Ruby Enterprise Edition with RVM
* Install RVM
zsh < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
rvm update --head
* Install Readline package
gem update ZenTest
gem install autotest-rails
gem install autotest-growl
gem install autotest-fsevent
Install growlnotify if not already installed
.zshrc
# For autotest
var Cache = function() {
this.table = {};
};
Cache.prototype = {
'get': function(key) {
return this.table[key];
},
'set': function(key, value) {
return this.table[key] = value;
1.
<script type="text/javascript" charset="utf-8">
function log(string){
document.getElementById('log').innerHTML += (string + '<br/>');
}
document.getElementById('the_div').addEventListener(
'click', function(){ log('the_div!') }, true);