Skip to content

Instantly share code, notes, and snippets.

@tealtail
Forked from phlco/drill.md
Last active December 24, 2015 16:09
Show Gist options
  • Save tealtail/6825624 to your computer and use it in GitHub Desktop.
Save tealtail/6825624 to your computer and use it in GitHub Desktop.

Emergency WDI Pick me up

Prompt

For today's drill, we're going to be creating a site like Emergency Compliment, except it will be WDI themed.

When a user visits the site, they'll be greeted with a WDI pick me up that will hopefully cheer them up.

Create a basic Sinatra app inside your drills folder called pick_me_up Create your main.rb file and a views folder. In your views folder, you'll have a layout.erb file and a compliment.erb file.

Phase 1

When I visit the root "/" of your app, it should display a greeting and a randomly chosen compliment. The background color of the app should be random as well.

Hints

Here is what my layout.erb file looks like. Notice for the background color, I am taking advantage of the embedded Ruby to pass in the color and make it dynamic. Also, you should not need to link an external stylesheet for this exercise.

<!doctype html>
<html lang='en'>
  <head>
    <meta charset='utf-8'>
    <title>PICK ME UP</title>
    <style>
    body {
      background-color: <%= @color %>;
      font-family: "Helvetica", "Arial", sans-serif;
      color: white;
    }
    .wrapper {
      width: 960px;
      margin: 0 auto;
    }
    .compliment {
      font-weight: bold;
      font-size: 72px;
      margin-top: 50px;
    }
    </style>
  </head>
  <body>
     <div class="wrapper">
      <h1>Emergency WDI Pickmeup</h1>
      <%= yield %>
      </div>
  </body>
</html>

Here are some compliments and colors. Feel free to substitute your own:

compliments = [
  "Your instructors love you",
  "That's a really nice e-cigarette",
  "Is it Ruby Tuesday yet?",
  "You are awesome.upcase",
  "Cardigan mumblecore Etsy, YOLO Marfa kogi art party",
  "(1..1_000_000).to_a.include?(you) == true"
]
colors = ["#FFBF00", "#0080FF","#01DF3A","#FF0080"]

##Phase 2

When I visit "/:name" ie "/sammy", the greeting should say hello to me. There should still be a random compliment and random background color.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment