#lemur/w02/d04
##ME: Days of our Lives
-
In a new Ruby file, create an array (and assign it to a variable) containing the days of the week as strings, with Monday as the first and Sunday as the last.
-
My calendar says Sunday is the first day of the week. Write code to move Sunday from the end of the array to the beginning.
-
I'm really excited about Thursday for some reason. Write code to find that day in the array and make it all uppercase.
-
Create and assign a new array which contains two sub-arrays: One containing all the weekdays, and one containing the weekends.
-
Let's get in touch with our Viking heritage. With your new array of arrays, write code that will change Wednesday to "Woden's Day".
-
On second thought, I don't like weekdays at all. Write code that deletes the weekdays from the array of arrays, leaving only the weekend days.
-
Going back to your original array of days, write code that sorts the days alphabetically and assigns these to a new variable.
-
Finally, print out (on the terminal) the list of sorted days, with each day on its own line.
##bills_from_billings
Using Andrew's video as a guide. Configure a Digital Ocean droplet and build a basic Sinatra application on it. Do not worry about complicated application logic. The point of this is to practice working with remote servers.
##blog
Do some blog stuff.
##sinatra_pick_me_up
Create a site like Emergency Compliment...except it will be WDI themed. When a Lemur visits the site, they'll be greeted with a compassionate, WDI-related message.
Folder structure:
├── Gemfile
├── Gemfile.lock
├── app.rb
├── config.ru
├── public
│ └── stylesheets
│ └── styles.css
└── views
├── compliment.erb
└── layout.erb
Part 1:
request | response |
---|---|
GET / |
Displays greeting and randomly chosen compliment. Displays a random background color. Displays form prompting user to input their name. Form submits POST request to /names . |
Part 2:
request | response |
---|---|
POST /names |
Receives form input. Redirects to "/names?name=#{the_name_from_params}" . |
GET /names |
Display random pick me up with name included in greeting |
Note:
It is considered bad practice to render html from a post request. This is why we redurect from our POST
request.