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
# offset = TimeZoneFinder.gmt_offset(some_lat, some_lng) | |
# timezone = ActiveSupport::TimeZone[offset] | |
# | |
# timezone = TimeZoneFinder.timezoneId(lat, lng) | |
# Time.zone = timezone | |
# Time.zone.now | |
# | |
class TimeZoneFinder | |
attr_accessor :result |
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
namespace :jquery do | |
desc "Installs the latest version of jQuery and the rails.js UJS jQuery Adapter" | |
task :install => :update do | |
puts "Installed jQuery and the rails.js UJS jQuery Adapter" | |
puts %Q{ | |
****************************************************************************** | |
You can update your javascript defaults in Rails3 with the following: | |
in application.rb, add: |
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
if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm') | |
begin | |
rvm_path = File.dirname(File.dirname(ENV['MY_RUBY_HOME'])) | |
rvm_lib_path = File.join(rvm_path, 'lib') | |
$LOAD_PATH.unshift rvm_lib_path | |
require 'rvm' | |
RVM.use_from_path! File.dirname(File.dirname(__FILE__)) | |
rescue LoadError | |
# RVM is unavailable at this point. | |
raise "RVM ruby lib is currently unavailable." |
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 allows you to use Passenger with RVM where each app has it's own gemset | |
# place the setup_load_paths.rb into your config folder of Rails app | |
if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm') | |
begin | |
rvm_path = File.dirname(File.dirname(ENV['MY_RUBY_HOME'])) | |
rvm_lib_path = File.join(rvm_path, 'lib') | |
$LOAD_PATH.unshift rvm_lib_path | |
require 'rvm' | |
RVM.use_from_path! File.dirname(File.dirname(__FILE__)) |
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
DAYS_BEFORE_OPTIONS = [0,1,2,3,4,5,6,7,14,21,28] | |
DAYS_BEFORE_IN_WORDS = ['the day of'] + (1..6).map {|day| "#{day} days before"} + (1..4).map {|week| "#{week} weeks before"} | |
def self.options_for_days_before | |
DAYS_BEFORE_OPTIONS.map do |days| | |
[DAYS_BEFORE_IN_WORDS[DAYS_BEFORE_OPTIONS.index(days)], days] | |
end | |
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
/* | |
A Revised Font Stack | |
from A Way Back | |
http://www.awayback.com/revised-font-stack/ | |
*/ | |
/* |