Skip to content

Instantly share code, notes, and snippets.

View eddorre's full-sized avatar

Carlos Rodriguez eddorre

View GitHub Profile
@eddorre
eddorre / gist:1329040
Created October 31, 2011 21:39
Rails 3.1 Dry database.yml with development as a variable
development: &shared
adapter: postgresql
enconding: utf8
host: localhost
pool: 5
username: postgres
password: postgres
database: myapp_development
test: &test
/*
Sample Propane caveatPatchor.js file based on tmm1's avatar hack.
You'll need at least version 1.1.1 to experiment with this:
http://propaneapp.com/appcast/Propane.1.1.1.zip
Once I'm sure exposing this hack-injection point doesn't cause problems
I'll do an official auto-updating version.
As of version 1.1.1, Propane will load and execute the contents of
var Cache = function() {
this.table = {};
};
Cache.prototype = {
'get': function(key) {
return this.table[key];
},
'set': function(key, value) {
return this.table[key] = value;
@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
#!/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
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!