Skip to content

Instantly share code, notes, and snippets.

@ptn
ptn / s.rb
Created April 11, 2012 14:19 — forked from jacksonwillis/s.rb
Sentences as Ruby code
class S; def initialize *w; @s=w; end; def method_missing *w;@s<<w;self;end;def
to_ary;[@s.map{ |e| e=~/[\,\.\:\-\(\)\/\'\"]/?[e]:[" ",e] }.join.strip];end;end
def Object.const_missing(c);S.new c;end; ###### https://gist.github.com/2354740
puts This.is.a.sentence.represented.by.a.Ruby.expression(",").try.it.out! #####
@ptn
ptn / 20111218135715_globalize_models.rb
Created September 2, 2012 00:58 — forked from kevinansfield/20111218135715_globalize_models.rb
Globalize3 support with tabs in Active Admin
# db/migrate/20111218135715_globalize_models.rb
class GlobalizeModels < ActiveRecord::Migration
def up
NewsItem.create_translation_table!(
{:title => :string, :body => :text},
{:migrate_data => true}
)
end