Skip to content

Instantly share code, notes, and snippets.

View vanderhoop's full-sized avatar
💭
🤷🏻‍♂️

Travis Vander Hoop vanderhoop

💭
🤷🏻‍♂️
View GitHub Profile

Intro to Heroku

We're going to be deploying our apps on Heroku, but what the heck is Heroku? Take 15 minutes to research and answer the following questions in the answer prompts provided.

  1. What is Heroku?
  • Answer:
  1. What is Heroku built upon?
  • Answer:
  1. What are some alternatives to Heroku?
  • Answer:

The Host

Directions

  1. Within server.rb, write a request handler so that when GET requests are made to "/host", we are taken to a page that show's Chris Harrison's name, occupation, age, and photo.
  2. Check your work in the browser.

Using super to Invoke the Method of the Same Name in a superclass

Sears has contracted you to continue working on an application that models its inventory. Sears is really struggling, and right now the only things they have in stock are bikes and shirts. The CEO of Sears took a computer programming course in college, and he knows that both bikes and shirts are examples of a Product. Thus, he has instructed you to reuse the code found in product.rb.

The Sears Class Heirarchy:

                             *Product* 
                             /       \  
                            /         \  
 / \

Redefining The Student Class

You just learned how to avoid repeating yourself by using class inheritance. Now you've been tasked with putting that knowledge to use.

Directions

  1. Within ~/dev/wdi/godot/w02/d04/student/wdi_the_program/, create a file called student.rb
  2. Within student.rb, define a barebones Student class and make it inherit the behaviors of the Human class
  3. In main.rb, use require_relative to bring in the code from student.rb
  • Note: Make sure you require the student.rb file after you've required human.rb, because the former is going to rely on the class definition in the latter.

Dissecting the student class

You just learned how to write a class definition with an initialize method. But it takes time for some concepts to sink in. Tats why you're going to partner up and explain your understanding in your own words.

Directions

  1. Partner up.
  2. Examine the code below with your partner.
  3. With your partner, answer the questions that follow.

Defining Classes with initialize

Exercise Objectives:

  • To get practice and build muscle memory writing class declarations
  • To get practice instantiating objects of your own design

Directions

  1. Write out class definitions outlined below:
  • a Shirt class
  • upon instantiation (meaning the creation of a new object of the Shirt class), the class's initialize method should take 3 arguments:

Defining the Student class

You just learned how to write a Ruby class definition, the abstract "blueprint" you'll use to create objects of your own design. Now put that knowledge to use.

Exercise Objective(s)

  • get meaningful reps writing class definitions with getter and setter methods

Directions

More Getter and Setter Methods

You just learned how to define getter and setter methods to a class definition, and also how use them in a program. Put your newfound knowledge to use.

Exercise Objectives

  • get meaningful reps defining getter and setter methods within a class definition
  • user setter methods to set attributes of an object
  • user getter methods to retieve attributes of an object

Intro to Blocks & Enumeration

Learning Objectives

  • Students should be able to:
    • Explain what a block is
    • Compare and contrast blocks and methods
    • User .each to iterate through arrays of unknown size

Part 1: Blocks

# bash <(curl -sL https://gist.githubusercontent.com/vanderhoop/82867f205fc07b415040/raw/a121d690283bc12c1a85b551524dae771ed95020/git_repo_setup_script.sh)
#################################################################################################################
# Note: This script presupposes that the user has reverted to a trashed commit that has all of their week 1 work.
#################################################################################################################
# grabs SSH clone url for fork, which we'll use to set up new repos
cd ~/dev/wdi/godot
export origin_url=$(git config --get remote.origin.url)