Skip to content

Instantly share code, notes, and snippets.

Avatar

Yuval Kordov uberllama

View GitHub Profile
@knomedia
knomedia / ember_cli_rails.rake
Last active Aug 29, 2015
ember_cli_rails initial thoughts (see: https://github.com/knomedia/ember-cli-rails for a more complete solution)
View ember_cli_rails.rake
require 'nokogiri'
namespace :ember_cli_rails do
desc "compile ember and update application.html.erb with ENV vars"
task :build => [:ember, :update_env] do
end
desc 'Build ember app and copies css and js files to rails'
@coryschires
coryschires / moment-timezone-data.js
Created Aug 14, 2013
TZInfo mapping between Rails and moment.js
View moment-timezone-data.js
moment.tz.add({
"zones": {
"Africa/Algiers": [
"0:12:12 - LMT 1891_2_15_0_1 0:12:12",
"0:9:21 - PMT 1911_2_11 0:9:21",
"0 Algeria WE%sT 1940_1_25_2",
"1 Algeria CE%sT 1946_9_7 1",
"0 - WET 1956_0_29",
"1 - CET 1963_3_14 1",
"0 Algeria WE%sT 1977_9_21 1",
@dnagir
dnagir / timezone.rb
Last active Dec 16, 2019
Rspec time zones sledgehammer
View timezone.rb
# spec/support/timezone.rb
module TimeZoneHelpers
extend ActiveSupport::Concern
def self.randomise_timezone!
offsets = ActiveSupport::TimeZone.all.group_by(&:formatted_offset)
zones = offsets[offsets.keys.sample] # Random offset to better vary the time zone differences
Time.zone = zones.sample # Random zone from the offset (can be just 1st, but let's do random)
puts "Current rand time zone: #{Time.zone}. Repro: Time.zone = #{Time.zone.name.inspect}"
end