Skip to content

Instantly share code, notes, and snippets.

View weidenfreak's full-sized avatar

Meike Bartel weidenfreak

View GitHub Profile
@weidenfreak
weidenfreak / repertory_grid_debug
Created May 10, 2015 10:47
OpenRepGrid Bug (?)
ELEMENTS
E1
E2
E8
E9
E4
E5
E6
@weidenfreak
weidenfreak / gist:3987304
Created October 31, 2012 14:23
DateTime has wrong offset
$ irb
>> require 'date'
=> true
# DateTime ignores time zone
>> DateTime.new(2012,9,10)
=> #<DateTime: 2012-09-10T00:00:00+00:00 ((2456181j,0s,0n),+0s,2299161j)>
# Time handles offset correctly
>> Time.new(2012, 9, 10)
@weidenfreak
weidenfreak / gist:3987288
Created October 31, 2012 14:21
Timecop and milliseconds
#
# freezing DateTime.now
#
# in Rails
$ rails c
Loading development environment (Rails 3.2.8)
# DateTime and Time have milliseconds before freezing time
>> DateTime.now.iso8601 9
@weidenfreak
weidenfreak / gist:3987229
Created October 31, 2012 14:11
DateTime in Rails is missing milliseconds after substracting 1 day, Time is not
$ irb
>> DateTime.now
=> #<DateTime: 2012-10-29T16:00:33+01:00 ((2456230j,54033s,774400000n),+3600s,2299161j)>
>> DateTime.now - 1
=> #<DateTime: 2012-10-28T16:00:37+01:00 ((2456229j,54037s,137431000n),+3600s,2299161j)>
$ rails c
>> DateTime.now.iso8601 9
=> "2012-10-29T16:03:17.237282000+01:00"