1+ defmodule Play do
2+ @ points [ % { "end" => 14000 , "message" => "And when the introduction keeps playing" ,
3+ "start" => 11000 } ,
4+ % { "end" => 18000 ,
5+ "message" => "We go to the second transition of the introduction" ,
6+ "start" => 14000 } ,
7+ % { "end" => 22000 , "message" => "We switch to the design section" ,
8+ "start" => 18000 } ,
9+ % { "end" => 26000 , "message" => "And the design section will show a picture" ,
10+ "start" => 22000 } ,
11+ % { "end" => 30000 ,
12+ "message" => "When I say the next word, we switch to the second picture" ,
13+ "start" => 26000 } ,
14+ % { "end" => 34000 , "message" => "And then the third picture" , "start" => 30000 } ,
15+ % { "end" => 37000 , "message" => "Then we switch to the architectural section" ,
16+ "start" => 34000 } ,
17+ % { "end" => 41000 , "message" => "And you see a picture" , "start" => 37000 } ,
18+ % { "end" => 45000 ,
19+ "message" => "And you talk a little bit more and there is a blog post" ,
20+ "start" => 41000 } ,
21+ % { "end" => 53000 ,
22+ "message" => "If you scroll down to the blog post it pauses what I say" ,
23+ "start" => 46000 } ,
24+ % { "end" => 60000 ,
25+ "message" => "Now that you scroll back up, I resume, and we keep talking" ,
26+ "start" => 54000 } ,
27+ % { "end" => 61000 , "message" => "And we go to the roadmap section" ,
28+ "start" => 60000 } ,
29+ % { "end" => 66000 ,
30+ "message" => "We're going through a little bit of a demo about the app model" ,
31+ "start" => 62000 } ,
32+ % { "end" => 69000 , "message" => "There's some fancy animation" ,
33+ "start" => 66000 } ,
34+ % { "end" => 73000 , "message" => "Talking about investors and paid users" ,
35+ "start" => 69000 } ,
36+ % { "end" => 78000 ,
37+ "message" => "What happens when all of this goes horribly wrong" ,
38+ "start" => 73000 } ]
39+
40+ def run ( base ) do
41+ origin ( @ points , base )
42+ |> Enum . map ( & Poison . encode! / 1 )
43+ |> Enum . each ( & IO . puts / 1 )
44+ end
45+
46+ def origin ( points , origin ) do
47+ Enum . map ( points , fn % { "start" => vstart , "end" => vend } = row ->
48+ % { row | "start" => vstart - origin , "end" => vend - origin }
49+ end )
50+ end
51+ end
0 commit comments