This repository has been archived by the owner on Nov 25, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 66
/
Copy pathapp.rb
70 lines (57 loc) · 1.47 KB
/
app.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
require_relative 'config/environment'
class App < Sinatra::Base
get '/' do
@error = params['error']
erb :home
end
post '/subscribe' do
@full_name = params[:full_name]
@email = params[:email]
if [email protected](/.+@.+/)
redirect to('/?error=email')
end
erb :subscribe
end
get '/reddit' do
# TODO: we can probably get the listings with something like:
# JSON.parse(RestClient.get('http://reddit.com/.json'))
@listings = []
erb :reddit
end
get '/schedule' do
@today = [
['7:00am', 'Wake up'],
['8:00am', 'Work Out'],
['9:00am', 'Product Meeting'],
['11:00am', 'Ping Pong Break'],
['1:00pm', 'Lunch'],
['3:00pm', 'Coffee Time'],
['6:30pm', 'Call it a day'],
]
@tomorrow = [
['7:00am', 'Wake up'],
['8:00am', 'Work Out'],
['9:00am', 'Inbox Zero'],
['11:00am', 'Ping Pong Break'],
['1:00pm', 'Lunch'],
['3:00pm', 'Coffee Time'],
['6:30pm', 'Meetup Presentation'],
]
erb :schedule
end
end
class App < Sinatra::Base
get '/fib/:n' do
# TODO: implement an algorithm to calculate the fibonacci sequence at
# the nth position and display
# (4) points
end
get '/team-randomizer' do
# TODO: provide a form with a textarea that asks for a list of comma
# separated names. Randomize this list of names and display it as an
# ordered list (<ol>). 5 points
end
def fib(n)
# TODO: calculate fib
end
end