Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panda level submission #12

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ gem 'rake'
gem 'activesupport'
gem 'sinatra'
gem 'sinatra-contrib'
gem 'shotgun'
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ GEM
rack-test (0.6.1)
rack (>= 1.0)
rake (0.9.2.2)
shotgun (0.9)
rack (>= 1.0)
sinatra (1.3.2)
rack (~> 1.3, >= 1.3.6)
rack-protection (~> 1.2)
Expand All @@ -33,5 +35,6 @@ PLATFORMS
DEPENDENCIES
activesupport
rake
shotgun
sinatra
sinatra-contrib
37 changes: 37 additions & 0 deletions my_picks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
-
book_name: The New Making of a Cook
author: Madeleine Kamman
description: The Making of a Cook became an instant classic upon its publication in 1971. Since then much has changed in the way America cooks and The New Making of a Cook meets these changes head-on. This fully revised edition teaches every technique used in today's homes and professional kitchens, from julienning vegetables to roasting meats to steaming fish to baking bread. With years of experience teaching America's top chefs how to cook, Madeleine knows what works and why.
url: http://www.amazon.com/The-New-Making-Cook-Techniques/dp/0688152546
image: http://ecx.images-amazon.com/images/I/512WPH9QP0L._SX258_BO1,204,203,200_.jpg
-
book_name: The Food and Life of Oaxaca, Mexico
author: Zarela Martinez
description: The Food and Life of Oaxaca, by New York restaurateur Zarela Martinez, is a fascinating cultural study disguised as a great cookbook. Martinez is part of the new renaissance of Mexican food writers and chefs, including Rick Bayless and Diana Kennedy, who reaffirm that culinary awareness goes hand in hand with cultural awareness.
url: http://www.amazon.com/The-Food-Life-Oaxaca-Mexico/dp/0028603508
image: http://ecx.images-amazon.com/images/I/51za6Qork%2BL._SX258_PJlook-inside-v2,TopRight,1,0_SH20_BO1,204,203,200_.jpg
-
book_name: Larousse Gastronomique
author: Prosper Montagne
description: Since its first publication in 1938, Larousse Gastronomique has been an unparalleled resource. In one volume, it presents the history of foods, eating, and restaurants; cooking terms; techniques from elementary to advanced; a review of basic ingredients with advice on recognizing, buying, storing, and using them; biographies of important culinary figures; and recommendations for cooking nearly everything.

url: http://www.amazon.com/Larousse-Gastronomique-Prosper-Montagne/dp/0609609718
image: http://ecx.images-amazon.com/images/I/41eqmG3PX2L._SY344_PJlook-inside-v2,TopRight,1,0_SH20_BO1,204,203,200_.jpg
-
book_name: Peace, Love, & Barbecue
author: Mike Mills
description: In this unique combination of cookbook, memoir, and travelogue, Mike Mills, the unrivalled king of barbecue, shares his passion for America's favorite cuisine--its intense smoky flavors, its lore and traditions, and its wild cast of characters.
url: http://www.amazon.com/Peace-Love-Barbecue-Recipes-Outright/dp/1594861099
image: http://ecx.images-amazon.com/images/I/51hJChNUmEL._SX258_PJlook-inside-v2,TopRight,1,0_SH20_BO1,204,203,200_.jpg
-
book_name: Authentic Mexican
author: Rick Bayless
description: Americans have at last discovered Mexico's passion for exciting food. We've fallen in love with the great Mexican combination of rich, earthy flavors and casual, festive dining. But we don't begin to imagine how sumptuous and varied the cooking of Mexico really is.
url: http://www.amazon.com/Authentic-Mexican-20th-Anniversary-Ed/dp/0061373265
image: http://ecx.images-amazon.com/images/I/51oZlXhw0NL._SY344_PJlook-inside-v2,TopRight,1,0_SH20_BO1,204,203,200_.jpg
-
book_name: The Art of Cooking Omelettes
author: Madame Romaine De Lyon
description: For 65 years, Madame Romaine de Lyon ran a popular restaurant in midtown New York that served only eggs. But not just any eggs! Mme de Lyon, was a master omelette chef. The walls of her restaurant were covered with signed photos of famous customers, such as Joan Rivers, Mary Tyler Moore, Anne Bancroft, and Mel Brooks (who wrote the screenplay for The Producers at his regular table in the back of the restaurant).
url: http://www.amazon.com/Cooking-Omelettes-Madame-Romaine-Lyon/dp/1626549508
image: http://ecx.images-amazon.com/images/I/51FmlfPHikL._SY344_BO1,204,203,200_.jpg
11 changes: 7 additions & 4 deletions theweb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@
require 'bundler/setup'
require 'sinatra'
require 'sinatra/reloader'
require 'yaml'
enable :sessions

get '/' do
erb :dashboard
end

post '/number' do
@number_of_randoms = session[:number_of_randoms] || 0
@number_of_randoms += 1
Expand All @@ -16,3 +13,9 @@
@the_number = rand(number_as_string)
erb :number
end

get '/' do
my_picks = YAML.load(File.read("./my_picks.yml"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NICE!!!

Each time the page loads, it will need to pick up this file and interpret the yml file.

I'm going to push you a pick on this: Can you think of a way to have these picks be a Ruby class that dont' change?

@featured_pick = my_picks.sample
erb :about
end
43 changes: 43 additions & 0 deletions views/about.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

<div class="row">
<div class="span3">
<img src="http://www.gravatar.com/avatar/154f018ffd2af17c45edf47eaa113b07.png?s=200">
</div>
<div class="span7 hero-unit">
<h1>About Me.</h1>
<p>
My name is Jason. I’ve been in the role of Business Analyst for over 10 years now.
</p>
</div>
</div>


<div class="row">
<div class="span8 offset3">
<p>
I didn’t set out to be a Business Analyst. In fact, I was initially a fine arts major. I like drawing pictures and thought it’d be cool to draw illustrations for a living… but things change, and I switched to a general business major.
</p>
<p>
I've always enjoyed solving the tough problems thrown my way as an analyst. There are patterns that are predictable, but there's always enough variability to keep it interesting. It's a bit like solving a puzzle.
</p>
</div>
</div>

<div class="row">
<div class=" span8 offset3">
<hr>
<h2>Featured cookbook recommendation:</h2>
<div class="row">
<div class="span2">
<img src="<%= @featured_pick["image"] %>">
</div>
<div class="span6">
<h3><%= @featured_pick["book_name"] %></h3>
<p>by <%= @featured_pick["author"] %></p>
<p>
<%= @featured_pick["description"] %>
</p>
</div>
</div>
</div>
</div>
15 changes: 9 additions & 6 deletions views/dashboard.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<h1>OH HAI THERE</h1>
<form method="POST" action="/number">
<label for="number">Max number for Randomitude</label>
<input type="text" id="number" name="number"/>
<input type="submit" class="btn btn-large btn-primary" value="View Number"/>
</form>

<div class="hero-unit">
<h1>OH HAI THERE</h1>
<form method="POST" action="/number">
<label for="number">Max number for Randomitude</label>
<input type="text" id="number" name="number"/>
<input type="submit" class="btn btn-large btn-primary" value="View Number"/>
</form>
</div>
34 changes: 6 additions & 28 deletions views/layout.erb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<div class="nav-collapse">
<ul class="nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#">About</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</div><!--/.nav-collapse -->
Expand All @@ -56,36 +56,14 @@

<div class="container">

<!-- Main hero unit for a primary marketing message or call to action -->
<div class="hero-unit">
<%= yield %>
</div>

<!-- Example row of columns -->
<div class="row">
<div class="span4">
<h2>Heading</h2>
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
<p><a class="btn" href="#">View details &raquo;</a></p>
</div>
<div class="span4">
<h2>Heading</h2>
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
<p><a class="btn" href="#">View details &raquo;</a></p>
</div>
<div class="span4">
<h2>Heading</h2>
<p>Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id ligula porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p>
<p><a class="btn" href="#">View details &raquo;</a></p>
</div>
</div>
<%= yield %>

<hr>

<footer>
<p>Number of Randoms: <%= @number_of_randoms %></p>
OH HAI THERE
<p>&copy; Company 2012</p>
<footer class="row">
<div class="span3 offset9"
<p>&copy; Company 2012</p>
</div>
</footer>

</div> <!-- /container -->
Expand Down
4 changes: 3 additions & 1 deletion views/number.erb
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
<h1>OH HAI THERE</h1>
<h2>The number is <%= @the_number %>
<h2>The number is <%= @the_number %></h2>

<p>Number of Randoms: <%= @number_of_randoms %></p>