Skip to content
This repository has been archived by the owner on Oct 13, 2020. It is now read-only.

Commit

Permalink
Adding times.
Browse files Browse the repository at this point in the history
  • Loading branch information
febuiles committed Jul 19, 2011
1 parent adac161 commit e70b5a3
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 47 deletions.
2 changes: 1 addition & 1 deletion app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>Timezones</title>
<title>zomgtime</title>
<%= stylesheet_link_tag "application" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
Expand Down
28 changes: 8 additions & 20 deletions app/views/pages/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,23 +1,11 @@
<!doctype html>
<head>
<meta charset="utf-8">
<title>Timezones</title>
<%= stylesheet_link_tag :defaults %>
</head>
<body>

<p><span class="purple">eastern</span>5:35</p>
<p><span class="pink">pacific</span>5:35</p>
<p><span class="lime">central</span>5:35</p>
<p><span class="green">mountain</span>5:35</p>
<p><span class="sea">gmt</span>5:35</p>
<p><span class="blue">gmt-5</span>5:35</p>
<p><span class="purple">eastern</span><%= Time.for("America/New_York") %></p>
<p><span class="pink">pacific</span><%= Time.for("America/Los_Angeles") %></p>
<p><span class="lime">central</span><%= Time.for("America/Chicago") %></p>
<p><span class="green">mountain</span><%= Time.for("America/Denver") %></p>
<p><span class="blue">colombia</span><%= Time.for("America/Bogota") %></p>
<p><span class="sea">gmt</span><%= Time.for("UTC") %></p>

<div>
<h1>timezones</h1>
developed by <%= link_to "federico", "http://mheroin.com", :class => "purple" %>. colors borrowed from <%= link_to "twistori", "http://twistori.com", :class => "pink" %> by <%= link_to "amy", "http://twitter.com/amyhoy", :class => "lime" %> and <%= link_to "thomas", "http://twitter.com/thomasfuchs", :class => "green" %>. they make a great product called <%= link_to "freckle", "http://letsfreckle.com", :class => "sea" %>. read the source code in <%= link_to "github", "http://github.com/febuiles/timezones", :class => "blue" %>.
<h1>zomgtime</h1>
developed by <%= link_to "federico", "http://mheroin.com", :class => "purple" %>. colors borrowed from <%= link_to "twistori", "http://twistori.com", :class => "pink" %> by <%= link_to "amy", "http://twitter.com/amyhoy", :class => "lime" %> and <%= link_to "thomas", "http://twitter.com/thomasfuchs", :class => "green" %>. they make a great product called <%= link_to "freckle", "http://letsfreckle.com", :class => "sea" %>. read the source code in <%= link_to "github", "http://github.com/febuiles/zomgtime", :class => "blue" %>.
</div>

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"></script>
</body>
</html>
29 changes: 3 additions & 26 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,18 @@

require "action_controller/railtie"

# If you have a Gemfile, require the gems listed there, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env) if defined?(Bundler)

module Timezones
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.

# Custom directories with classes and modules you want to be autoloadable.
# config.autoload_paths += %W(#{config.root}/extras)

# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named.
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]

# Activate observers that should always be running.
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer

# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'

# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
config.time_zone = 'UTC'

# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8"

# Configure sensitive parameters which will be filtered from the log file.
config.filter_parameters += [:password]

# Enable the asset pipeline
config.assets.enabled = true
end
end


7 changes: 7 additions & 0 deletions config/initializers/time.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Time::DATE_FORMATS[:default] = "%H:%M"

class Time
def self.for(tz)
TZInfo::Timezone.get(tz).now
end
end

0 comments on commit e70b5a3

Please sign in to comment.