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
class DateTimeSelector | |
include TagHelper | |
POSITIONS = { :year => 1, :month => 2, :day => 3, :hour => 4, :minute => 5, :second => 6 } | |
def initialize(date, options={}) | |
@date = date | |
@options = options | |
@object = @options.delete(:object) | |
@object_name = @options.delete(:object_name) |
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
Object.class_eval do | |
def deep_clone | |
Marshal::load(Marshal.dump(self)) | |
end | |
end | |
Array.class_eval do | |
def sum | |
self.inject(0) { |sum, element| sum += element } | |
end |
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
ActionController::Base.logger.info "[Base] Loading config/initializers/" + File.basename(__FILE__) | |
class String | |
def to_permalink | |
text = self.dup | |
replacements = { | |
# replacement special character(s) to be replaced | |
"A" => [ "À", "Á", "Â", "Ã", "Å"], | |
"Ae" => [ "Ä", "Æ" ], | |
"C" => [ "Ç" ], |
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
# config | |
:number => { | |
:format => { | |
:precision => 3, | |
:separator => '.', | |
:delimiter => ',' | |
}, | |
:currency => { | |
:format => { | |
:unit => '$', |
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
def number_to_human_size(number, *args) | |
return number.nil? ? nil : pluralize(number.to_i, "Byte") if number.to_i < 1024 | |
options = args.extract_options! | |
options.symbolize_keys! | |
defaults, human = I18n.translate([:'number.format', :'number.human.format'], :locale => options[:locale]) || [{},{}] | |
defaults = defaults.merge(human) | |
unless args.empty? |
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
[11:21pm] clemensk: my idea is to pretty much remove the DATE_FORMATS constants and deprecate them | |
[11:21pm] clemensk: like it has been done with the COUNTRIES in the form options helper | |
[11:21pm] clemensk: and instead have a DEFAULT_FORMATS constant | |
[11:22pm] clemensk: that holds all the formats that are used internally by rails | |
[11:22pm] clemensk: like :db, :number and :rfc822 | |
[11:22pm] clemensk: assume someone calles Time.now.to_s(:long) | |
[11:22pm] clemensk: this would first do a lookup in DEFAULT_FORMATS | |
[11:23pm] clemensk: and then, if it doesn't find it there, it'd do I18n.localize(self, format) | |
[11:23pm] clemensk: and if it's not stored in the locale either, it falls back to to_default_s | |
[11:23pm] svenfuchs: hi peeps |
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
# with :show_sign option and extended :format | |
def number_to_currency(number, options = {}) | |
options.symbolize_keys! | |
defaults = I18n.translate(:'number.format', :locale => options[:locale], :raise => true) rescue {} | |
currency = I18n.translate(:'number.currency.format', :locale => options[:locale], :raise => true) rescue {} | |
defaults = defaults.merge(currency) | |
precision = options[:precision] || defaults[:precision] | |
unit = options[:unit] || defaults[:unit] |
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
Who's up to a post-railsconfeu08-coolest-quotes-tshirt-site? | |
Rails doesn't scale! (Oscar Wilde) | |
Look at all the things I'm not doing! (DHH) | |
Most people don't need Zulu on your website. (Josh Harvey) | |
Fork this + add your favorite quotest! |
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
Who's up to a post-railsconfeu08-coolest-quotes-tshirt-site? | |
Rails doesn't scale! (Oscar Wilde) | |
Look at all the things I'm not doing! (DHH) | |
Most people don't need Zulu on your website. (Josh Harvey) | |
t :rails (Sven Fuchs) | |
Fork this + add your favorite quotes! |
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
Processing ApplicationController#index (for 127.0.0.1 at 2008-09-13 18:23:53) [GET] | |
Session ID: BAh7CDoKbW9udGhpDjoJeWVhcmkC2AciCmZsYXNoSUM6J0FjdGlvbkNvbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhhc2h7AAY6CkB1c2VkewA=--0b0ba3c6eee1b81e8ed36c05e8beac6153ec9c3c | |
Parameters: {} | |
Rendering template within layouts/application | |
Rendering /Users/clemens/Rails/Projects/events_moedling/app/views/errors/404.html.erb (404) | |
SQL (0.2ms) SET NAMES 'utf8' | |
SQL (0.1ms) SET SQL_AUTO_IS_NULL=0 | |
SQL (0.1ms) SET NAMES 'utf8' | |
SQL (0.1ms) SET SQL_AUTO_IS_NULL=0 | |
Event Load (1981.6ms) SELECT DISTINCT(taggings.taggable_id), events.*, opening_hours.details AS opening_hours_details, opening_hours.day AS day FROM `events` INNER JOIN `opening_hours` ON `opening_hours`.visitable_id = `events`.id AND `opening_hours`.visitable_type = 'Event' INNER JOIN `locations` ON `locations`.id = `events`.location_id INNER JOIN `cities` ON `cities`.id = `locations`.city_id INNER JOIN `opening_hours` opening_hours_events ON `opening_hours_ |
OlderNewer