Skip to content

Instantly share code, notes, and snippets.

View rrrene's full-sized avatar
👶
Chasing a toddler. I may be slow to respond.

René Föhring rrrene

👶
Chasing a toddler. I may be slow to respond.
View GitHub Profile
@rrrene
rrrene / simplify_string.rb
Created July 19, 2010 21:17
Replace european accents and umlauts with their simple counterparts
# Replace european accents and umlauts with their simple counterparts
# ä -> a, ç -> c, etc.
class String
def simplify
gsub(/[àáâãäåæ]/i, 'a').
gsub(/[ç]/i, 'c').
gsub(/[èéêë]/i, 'e').
gsub(/[ìíîï]/i, 'i').
gsub(/[ñ]/i, 'n').
@rrrene
rrrene / my_console.rb
Created July 11, 2010 08:22
custom IRB console
#!/usr/bin/env ruby -wKU
# ... do some awesome stuff (requires, variable initialization, etc.)
require 'irb'
require 'irb/completion'
IRB.start
@rrrene
rrrene / all_models.rb
Created July 10, 2010 23:16
All Models in rails (that are already loaded)
# All Models in rails (that are already loaded)
Object.constants.map { |c|
c.constantize
}.select { |klass|
klass.is_a?(Class) && klass < ActiveRecord::Base
}