Skip to content

Instantly share code, notes, and snippets.

View jory.txt
Purging db...
Include Seeds? (N|y): y
== Including Seeds
== Migrating to latest...
== AddPlatforms: migrating ===================================================
== AddPlatforms: migrated (0.0060s) ==========================================
== AddDevices: migrating =====================================================
== AddDevices: migrated (0.0057s) ============================================
View gist:628440
## app/models/legacy/article.rb [ruby_on_rails]
class Legacy::Node < Legacy::Base
set_table_name 'node'
set_inheritance_column :node_type
set_primary_key :nid
default_scope select("*, concat('Legacy::', IF(type = 'ic_article', 'Article', IF(type = 'ic_video', 'Video', concat(UPPER(SUBSTRING(type, 1, 1)), LOWER(SUBSTRING(type, 2)))))) as node_type")
end
View gist:391464
a=[10,20,30,40,50]
i = 0
a.each_index {|i|
break if a[i] > 20
}
View url_dsl.rb
require 'open-uri'
# url dsl -- the ultimate url dsl!
#
# You just can't beat this:
#
# $ irb -r url_dsl
# >> include URLDSL
# => Object
# >> http://github.com/defunkt.json
View production.rb
# version 2.0 of http://ozmm.org/posts/easy_rails_asset_ids_with_git.html
repo = Grit::Repo.new('/path/to/your/app/shared/cached-copy')
js = repo.log('deploy', 'public/javascripts', :max_count => 1).first
css = repo.log('deploy', 'public/stylesheets', :max_count => 1).first
ENV['RAILS_ASSET_ID'] = js.committed_date > css.committed_date ? js.id : css.id
View takes into account new normalization for Jan De Poorter
1926 David Heinemeier Hansson
1615 Jeremy Kemper
436 Rick Olson
377 Josh Peek
354 Jamis Buck
339 Nicholas Seckar
295 Michael Koziarski
244 Pratik Naik
156 Marcel Molina Jr.
142 Geoff Buesing