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
# Resolving permission corruption | |
chmod -R 755 photos | |
find photos/ -type f -perm 755 -print0 | xargs -0 chmod 644 |
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
You can represent time statements in most western languages where | |
a prefix and/or suffix is used. | |
The default case is to use suffix only (as in English), which you | |
do by providing the `suffixAgo` and `suffixFromNow` settings in | |
the strings hash (earlier versions of timeago used the deprecated | |
`ago` and `fromNow` options). If present, they are used. | |
2 minutes [suffixAgo] | |
2 minutes [suffixFromNow] |
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> |
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
(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
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
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
[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
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
"Poke %s!" % %w{him her}[@user.sex] |