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
# default zone | |
Time.zone # => (GMT+00:00) UTC | |
# then we can assign zone like use "Hawaii" | |
Time.zone = "Hawaii" # => "Hawaii" | |
# then do local using zone | |
local = Time.zone.local(2012, 8, 1, 15, 30, 45) # => Wed, 01 Aug 2012 15:30:45 HST -10:00 | |
# then save this local to a column and save |
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 Time.using_zone_of(zone) | |
Time.zone = zone | |
yield | |
Time.zone = 'UTC' | |
end | |
Time.using_zone_of("Hawaii") do | |
puts Time.zone.now | |
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
# JAVA_OPTS and Procfiles | |
JAVA_OPTS: -Djruby.memory.max=384m -Xmx384m -Xms256m -Xss512k -XX:+UseCompressedOops -XX:+PrintGCDetails | |
# puma backed app's Procfile | |
web: bundle exec rails server puma -p $PORT -e $RACK_ENV | |
# torquebox-lite backed app's Procfile | |
web: bin/torquebox-lite -b 0.0.0.0 -p $PORT --max-threads=8 |
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
require "amqp" | |
EventMachine.run do | |
connection = AMQP.connect | |
channel = AMQP::Channel.new(connection) | |
replies_queue = channel.queue("", :exclusive => true, :auto_delete => true) | |
replies_queue.subscribe do |metadata, payload| | |
puts "[response] Response for #{metadata.correlation_id}: #{payload.inspect}" | |
end |
OlderNewer