This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class String | |
| # | |
| # http://rors.org/2008/7/09/alternative-join-and-split-in-ruby | |
| # | |
| alias / :split | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Definition.find_in_batches { |group| group.each { |item| item.save } } | |
| Video.find_in_batches { |group| group.each { |item| item.save } } | |
| AttachedImage.find_in_batches(:conditions => 'parent_id is null') { |group| group.each { |item| item.save } } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "Poke %s!" % %w{him her}[@user.sex] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Haml | |
| module Filters | |
| module Code | |
| include Base | |
| def render(text) | |
| text = Haml::Helpers.html_escape(text) | |
| text = Haml::Helpers.preserve(text) | |
| text | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [options[:class], clazz].compact * ' ' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| names.split(/\s*,\s*/).each { |name| ... } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| namespace :test do | |
| RCOV = "rcov --rails --aggregate coverage.data --text-summary -Ilib" | |
| def rcov_on(files_selector) | |
| unless Dir[files_selector].size == 0 | |
| system("#{RCOV} --html #{files_selector}") | |
| end | |
| end | |
| desc 'Measures test coverage' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (0..6).map {|i| i.day.ago.strftime("%a")[0,1] } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| >> params = {"line_items"=>[{"quantity"=>"1"}, {"quantity"=>"2"}]} | |
| => {"line_items"=>[{"quantity"=>"1"}, {"quantity"=>"2"}]} | |
| >> query = CGI::unescape(params.to_query) | |
| => "line_items[][quantity]=1&line_items[][quantity]=2" | |
| >> parsed_params = ActionController::AbstractRequest.parse_query_parameters(query) | |
| => {"line_items"=>[{"quantity"=>"1"}, {"quantity"=>"2"}]} | |
| >> params == parsed_params |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <a class="hide" href="javascript:void(0);">hide</a> |
OlderNewer