rabbit-slide-zundan-rails-timez-tqrk10 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8e368ffc8c3746cf01b5ed346406e78f2ab40e86
4
+ data.tar.gz: 7bc2c32748a3c5c5dd263e6b0c9b7339dd934cbc
5
+ SHA512:
6
+ metadata.gz: db2d79ae0fe3a934461c85bb63ad3326eafefbe316b05f9f0c47e5a504647b340dcca6db2b5a4252542e5753c82e7647d9de9964aeebd1c0d5fd62e1ea3c5a63
7
+ data.tar.gz: 6d4d5806375335a83d926474c4dacdb80f670146557c55eca84a8c3d604c026f6e8b711570f8b1e6e952ff5a1d6e09651d8643ff9e0ab8d1b4f79ce14c1895b0
data/.rabbit ADDED
@@ -0,0 +1 @@
1
+ rails-timez-tqrk10.rab
data/README.md ADDED
@@ -0,0 +1,28 @@
1
+ # Railsの日付とか時刻オブジェクトたちはどこのタイムゾーンにいるでしょうか
2
+ Presented as a lightning talk in TokyuRubykaigi10 #trk10 on 2016-05-29
3
+
4
+ ## For author
5
+ ### Show
6
+
7
+ ```
8
+ rake
9
+ ```
10
+
11
+ ### Publish
12
+
13
+ ```
14
+ rake publish
15
+ ```
16
+
17
+ ## For viewers
18
+ ### Install
19
+
20
+ ```
21
+ gem install rabbit-slide-zundan-rails-timez-tqrk10
22
+ ```
23
+
24
+ ### Show
25
+
26
+ ```
27
+ rabbit rabbit-slide-zundan-rails-timez-tqrk10.gem
28
+ ```
data/Rakefile ADDED
@@ -0,0 +1,17 @@
1
+ require "rabbit/task/slide"
2
+
3
+ # Edit ./config.yaml to customize meta data
4
+
5
+ spec = nil
6
+ Rabbit::Task::Slide.new do |task|
7
+ spec = task.spec
8
+ # spec.files += Dir.glob("doc/**/*.*")
9
+ # spec.files -= Dir.glob("private/**/*.*")
10
+ # spec.add_runtime_dependency("YOUR THEME")
11
+ end
12
+
13
+ desc "Tag #{spec.version}"
14
+ task :tag do
15
+ sh("git", "tag", "-a", spec.version.to_s, "-m", "Publish #{spec.version}")
16
+ sh("git", "push", "--tags")
17
+ end
data/anmitsu.jpg ADDED
Binary file
data/config.yaml ADDED
@@ -0,0 +1,21 @@
1
+ ---
2
+ id: rails-timez-tqrk10
3
+ base_name: rails-timez-tqrk10
4
+ tags:
5
+ - rails
6
+ - timezones
7
+ presentation_date:
8
+ version: 1.0.0
9
+ licenses: []
10
+ slideshare_id:
11
+ speaker_deck_id:
12
+ ustream_id:
13
+ vimeo_id:
14
+ youtube_id:
15
+ author:
16
+ markup_language: :rd
17
+ name: zunda
18
+ email: zundan@gmail.com
19
+ rubygems_user: zundan
20
+ slideshare_user: zunda
21
+ speaker_deck_user:
@@ -0,0 +1,277 @@
1
+ = Railsの日付とか時刻オブジェクトたちはどこのタイムゾーンにいるでしょうか
2
+
3
+ # : subtitle
4
+ # SUBTITLE
5
+ #: author
6
+ # zunda
7
+ # : institution
8
+ # Heroku/Support
9
+ # : content-source
10
+ # TokyuRubykaigi10
11
+ # : date
12
+ # 2016-05-29
13
+ # : allotted-time
14
+ # 5m
15
+ : theme
16
+ lightning-talk-with-code
17
+
18
+ = tl;dr
19
+ = RailsではTime.zoneをつかおう
20
+
21
+ = @zundan
22
+ # image
23
+ # src = anmitsu.jpg
24
+ # relative_height = 100
25
+ = @zundan
26
+ # image
27
+ # src = heroku-logotype-horizontal-purple.png
28
+ # relative_width = 100
29
+
30
+ = TTaaS
31
+ = @heroku
32
+ # image
33
+ # src = ttaas.png
34
+ # relative_width = 100
35
+
36
+ = Time Travel as a Service
37
+
38
+ = @edmundleexz
39
+ # image
40
+ # src = ttaas-irb.png
41
+ # relative_height = 100
42
+
43
+ = mjd?
44
+ # enscript ruby
45
+ > Date.today == Date.tomorrow
46
+ => true
47
+ > Date.today
48
+ => 2016-04-12
49
+ > Date.yesterday
50
+ => 2016-04-10
51
+
52
+ = mjd!
53
+ # enscript ruby
54
+ $ irb -r date
55
+ > Date.today.mjd
56
+ => 57489
57
+
58
+ 修正ユリウス日
59
+
60
+ Modified Julian Date
61
+
62
+ = 再現してみよう
63
+ = HerokuはUTC
64
+ # pango
65
+ $ heroku run date +%Z
66
+ Running date +%Z ... up, run.1234
67
+ <span foreground="red">UTC</span>
68
+
69
+ = RailsをPDTに
70
+ # enscript ruby
71
+ # config/application.rb
72
+ module RailsTimez
73
+ class Application < Rails::Application
74
+ ENV['TZ'] = 'UTC'
75
+ config.time_zone = 'America/Los_Angeles'
76
+ end
77
+ end
78
+
79
+ = mjd!
80
+ # enscript ruby
81
+ > Date.today == Date.tomorrow
82
+ => true
83
+ > Date.today
84
+ => 2016-04-12
85
+ > Date.yesterday
86
+ => 2016-04-10
87
+
88
+ = Ruby vs Rails (irb)
89
+ # enscript ruby
90
+ $ bundle exec irb -r timecop
91
+ > Timecop.freeze(
92
+ Time.new(2016, 4, 11, 18, 59, 0, "-07:00"))
93
+ => 2016-04-12 01:59:00 +0000
94
+
95
+ > Date.today
96
+ => <Date: 2016-04-11 (...)>
97
+ > Date.yesterday
98
+ # undefined method `yesterday' for Date:Class
99
+ > Date.tomorrow
100
+ # undefined method `tomorrow' for Date:Class
101
+
102
+ = Ruby vs Rails (rails c)
103
+ # enscript ruby
104
+ $ bundle exec rails c
105
+ > Timecop.freeze(
106
+ Time.new(2016, 4, 11, 18, 59, 0, "-07:00"))
107
+ => 2016-04-12 01:59:00 +0000
108
+
109
+ > Date.today
110
+ => Tue, 12 Apr 2016
111
+ > Date.yesterday
112
+ => Sun, 10 Apr 2016
113
+ > Date.tomorrow
114
+ => Tue, 12 Apr 2016
115
+
116
+ = Ruby vs Rails
117
+ # enscript ruby
118
+ $ bundle exec irb -r timecop
119
+ > Timecop.freeze(
120
+ Time.new(2016, 4, 11, 18, 59, 0, "-07:00"))
121
+ => 2016-04-12 01:59:00 +0000
122
+
123
+ * 4月12日 (UTC +00:00)
124
+ * 4月11日 (PDT -07:00)
125
+
126
+ = Railsを知らない子はその設定を知らない
127
+ = Date.todayはRuby
128
+ = 昨日と明日はRails
129
+
130
+ = qiita.com/jnchito
131
+ = 「RailsならTimeWithZoneを使う」
132
+
133
+ = TimeWithZone
134
+ # enscript ruby
135
+ $ bundle exec rails c
136
+ > Time.zone.today == Time.zone.tomorrow
137
+ => false
138
+ > Time.zone.today
139
+ => Mon, 11 Apr 2016
140
+ > Time.zone.yesterday
141
+ => Sun, 10 Apr 2016
142
+
143
+ = TimeWithZone
144
+ # enscript ruby
145
+ $ bundle exec rails c
146
+ > Time.now
147
+ => 2016-04-12 01:59:00 +0000
148
+ > Time.zone.now
149
+ => Mon, 11 Apr 2016 18:59:00 PDT -07:00
150
+
151
+ * 4月12日 (UTC +00:00)
152
+ * 4月11日 (PDT -07:00)
153
+
154
+ = ユーザー毎のタイムゾーン変換
155
+ = ※Pumaはマルチスレッド
156
+ = タイムゾーン変換
157
+ # enscript ruby
158
+ Thread.new do
159
+ ENV['TZ'] = tz
160
+ time_str = time.strftime("%H:%M")
161
+ :
162
+ end
163
+ = タイムゾーン変換
164
+ # enscript sh
165
+ $ bundle exec rake timezones:sys:travel
166
+ Traveling time ...!!!!
167
+ 03:00 UTC became 22:00 in Japan (shuold be 12:00)
168
+ 03:00 UTC became 03:00 in HST (shuold be 17:00)
169
+ 03:00 UTC became 12:00 in EST (shuold be 22:00)
170
+ 03:00 UTC became 17:00 in Japan (shuold be 12:00)
171
+ = ENV['TZ']変えるのはスレッドセーフじゃない
172
+ = タイムゾーン変換
173
+ # enscript ruby
174
+ Thread.new do
175
+ time_str = time_with_zone.\
176
+ in_time_zone(tz).strftime("%H:%M")
177
+ :
178
+ end
179
+ = タイムゾーン変換
180
+ # enscript sh
181
+ $ bundle exec rake timezones:rails:travel
182
+ Traveling time ...
183
+ completed time travel
184
+ = in_time_zoneはスレッドセーフっぽい
185
+
186
+ = どうやって?
187
+ = どうやって?
188
+ # enscript sh
189
+ $ grep tz Gemfile.lock
190
+ tzinfo (~> 1.1)
191
+ tzinfo (1.2.2)
192
+ = github/tzinfo/tzinfo
193
+ = Ruby Timezone Library
194
+ = メンテナンス大変じゃね?
195
+ = "search for a zoneinfo directory"
196
+ = Zoneinfo directory
197
+ # enscript ruby
198
+ > require 'tzinfo/data'
199
+ # LoadError: cannot load such file -- tzinfo/data
200
+ > TZInfo::ZoneinfoDataSource::DEFAULT_SEARCH_PATH
201
+ => ["/usr/share/zoneinfo",
202
+ "/usr/share/lib/zoneinfo",
203
+ "/etc/zoneinfo"]
204
+ = Zoneinfo directory
205
+ # enscript sh
206
+ $ ls /usr/share/zoneinfo/
207
+ +VERSION Cuba GMT-0 MET ROK
208
+ Africa/ EET GMT0 MST Singapore
209
+ America/ EST Greenwich MST7MDT Turkey
210
+ Antarctica/ EST5EDT HST Mexico/ UCT
211
+ Arctic/ Egypt Hongkong NZ US/
212
+ Asia/ Eire Iceland NZ-CHAT UTC
213
+ Atlantic/ Etc/ Indian/ Navajo Universal
214
+ Australia/ Europe/ Iran PRC W-SU
215
+ Brazil/ Factory Israel PST8PDT WET
216
+ CET GB Jamaica Pacific/ Zulu
217
+ CST6CDT GB-Eire Japan Poland iso3166.tab
218
+ Canada/ GMT Kwajalein Portugal posixrules
219
+ Chile/ GMT+0 Libya ROC zone.tab
220
+ = よくできてた!
221
+ = よくできてた!
222
+ $ bundle exec rake tzinfo:patch
223
+ :
224
+ TZInfo::TimezoneOffset.new
225
+ @abbreviation = KST
226
+ @std_offset = 0
227
+ @utc_offset = 32400
228
+ @utc_total_offset = 32400
229
+ TZInfo::TimezoneOffset#to_local(2015-08-15 00:00:00 UTC)
230
+ 2015-08-15 08:30:00 +0830
231
+
232
+ = ちなみに
233
+ = github/tzinfo/ tzinfo-data
234
+ = Timezone Data for TZInfo
235
+ = あればこっちを使う
236
+ = github/tzinfo/tzinfo-data
237
+ # image
238
+ # src = tzinfo-data-2016d.png
239
+ # relative_width = 100
240
+ = ちゃんとメンテナンスされてる!
241
+
242
+ = あ、そういえば
243
+ = Heroku Postgres
244
+ = Heroku Postgres
245
+ # enscript sql
246
+ $ heroku pg:psql
247
+ ---> Connecting to DATABASE_URL
248
+ :
249
+ app-name:DATABASE=> SELECT current_date, current_time;
250
+ date | timetz
251
+ ------------+--------------------
252
+ 2016-05-12 | 03:05:14.943494+00
253
+ (1 row)
254
+ UTCで待ってます。
255
+
256
+ = ところで
257
+ = サポート
258
+ = 「昨日の夜アプリが遅かったんだけど」
259
+ = どこのタイムゾーンで昨日よー
260
+ = そもそも 今 何日よー
261
+ = 時刻には日付とタイムゾーンもよろしく
262
+
263
+ = タイムゾーン重要
264
+
265
+ = URLs
266
+ * @heroku/status/719712029343395841
267
+ * @edmundleexz/status/719706359759917056
268
+ * github.com/zunda/rails-timez
269
+ * qiita.com/jnchito/items/cae89ee43c30f5d6fa2c
270
+
271
+ = CC BY-ND 4.0
272
+ Presented as a lightning talk in TokyuRubykaigi10 #tqrk10 on 2016-05-29
273
+
274
+ Copyright 2016 by zunda <zundan@gmail.com>
275
+
276
+ * github.com/zunda
277
+ * twitter.com/zundan
data/ttaas-irb.png ADDED
Binary file
data/ttaas.png ADDED
Binary file
Binary file
metadata ADDED
@@ -0,0 +1,69 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rabbit-slide-zundan-rails-timez-tqrk10
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - zunda
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-05-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rabbit
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 2.0.2
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 2.0.2
27
+ description: ''
28
+ email:
29
+ - zundan@gmail.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ".rabbit"
35
+ - README.md
36
+ - Rakefile
37
+ - anmitsu.jpg
38
+ - config.yaml
39
+ - heroku-logotype-horizontal-purple.png
40
+ - pdf/rails-timez-tqrk10-rails-timez-tqrk10.pdf
41
+ - rails-timez-tqrk10.rab
42
+ - ttaas-irb.png
43
+ - ttaas.png
44
+ - tzinfo-data-2016d.png
45
+ homepage: http://slide.rabbit-shocker.org/authors/zundan/rails-timez-tqrk10/
46
+ licenses: []
47
+ metadata: {}
48
+ post_install_message:
49
+ rdoc_options: []
50
+ require_paths:
51
+ - lib
52
+ required_ruby_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ requirements: []
63
+ rubyforge_project:
64
+ rubygems_version: 2.5.1
65
+ signing_key:
66
+ specification_version: 4
67
+ summary: 'Railsの日付とか時刻オブジェクトたちはどこのタイムゾーンにいるでしょうか Presented as a lightning talk in
68
+ TokyuRubykaigi10 #trk10 on 2016-05-29'
69
+ test_files: []