This file contains 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 FormattedDateAttributes | |
# Define virtual formatted date attribute | |
# | |
# formatted_date_attribute(:start_at, :end_at, :format => :default) | |
# formatted_date_attribute(:start_at, :end_at, :format => '%d/%m/%y') | |
# | |
# format parameter can be a symbol from config/initializers/date_time_formats.rb or any | |
# string format that will work with Date#strftime and DateTime.strptime methods | |
def formatted_date_attributes(*args) | |
options = { :format => :default }.merge(args.extract_options!) |
This file contains 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
# This Rack middleware helps solving the issue with some Rails versions which do not accept | |
# a '*/*;q=0.6' and their variants 'Accept' request header. This header is particularly used | |
# by Google Bot, and if Rails doesn't like it, it will return a 500 or 406 error to Google Bot, | |
# which is not the best way to get your pages indexed. | |
# | |
# References: | |
# - http://stackoverflow.com/questions/8881756/googlebot-receiving-missing-template-error-for-an-existing-template | |
# - https://github.com/rails/rails/issues/4127 | |
# | |
class GoogleBotAware |
This file contains 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
search_for = '46846' | |
value = '00000' | |
stats = [] | |
search_for.size.times do |index| | |
stats[index] ||= [] | |
10.times do |digit| |