diff --git a/02_Variables_Conditionals/starter_code/code_demo_boolean.rb b/02_Variables_Conditionals/starter_code/code_demo_boolean.rb
index ea3d367..61e4f89 100644
--- a/02_Variables_Conditionals/starter_code/code_demo_boolean.rb
+++ b/02_Variables_Conditionals/starter_code/code_demo_boolean.rb
@@ -2,15 +2,22 @@
#Let the computer do the work for you!
puts "Is 7 greater than 8?"
+puts 7>8
puts "Is 8 x 77 greater than 600?"
+puts (8*77) > 600
puts "Is 1 equal to (7 - 6)?"
+puts 1 == (7-6)
puts "Is 77 greater than 50 AND (88 / 3) less than 30?"
+puts (77 > 50) and (88/3 < 30)
puts "Is the length of the word 'wheelbarrow' more than 10 characters long?"
+puts "wheelbarrow".length > 10
puts "Are the amount of seconds in an hour greater than or equal to 3000?"
+puts (60*60) >= 3000
puts "Does the word 'slaughter' include the word laughter?"
+puts "slaughter".include? "laughter"
\ No newline at end of file
diff --git a/02_Variables_Conditionals/starter_code/ex_teddit_conditional.rb b/02_Variables_Conditionals/starter_code/ex_teddit_conditional.rb
index 53a43f8..614d3da 100644
--- a/02_Variables_Conditionals/starter_code/ex_teddit_conditional.rb
+++ b/02_Variables_Conditionals/starter_code/ex_teddit_conditional.rb
@@ -5,7 +5,7 @@
# Where you see comments (lines that begin with #) replace it with code so that the program works.
def get_input
- #Get input from the user.
+ gets.strip
end
def calculate_upvotes(story, category)
@@ -16,6 +16,23 @@ def calculate_upvotes(story, category)
#For example:
# "Cats frolic despite tuna shortage" should give you 5 times the upvotes!
+
+ upvotes = 1
+
+ if story.downcase.include? "cat" or category.downcase.include? "cat"
+ upvotes = upvotes * 5
+ end
+
+ if story.downcase.include? "bacon" or category.downcase.include? "bacon"
+ upvotes = upvotes * 8
+ end
+
+ if category.capitalize == "Food"
+ upvotes = upvotes * 3
+ end
+
+ return upvotes
+
end
puts "Welcome to Teddit! a text based news aggregator. Get today's news tomorrow!"
diff --git a/05_Classes_Objects/starter_code/ex_apartment_objects/lib/apartment.rb b/05_Classes_Objects/starter_code/ex_apartment_objects/lib/apartment.rb
index 80f73f0..1896635 100644
--- a/05_Classes_Objects/starter_code/ex_apartment_objects/lib/apartment.rb
+++ b/05_Classes_Objects/starter_code/ex_apartment_objects/lib/apartment.rb
@@ -1,4 +1,17 @@
#Apartment class.
class Apartment
+ attr_accessor :rent, :renter
+ attr_reader :name, :sqft, :bedrooms, :bathrooms
+
+ def initialize(name, sqft, bedrooms, bathrooms)
+ @name = name
+ @sqft = sqft
+ @bedrooms = bedrooms
+ @bathrooms = bathrooms
+ end
+
+ def to_s
+ "Name: #{@name}\n Square Feet: #{@sqft}\tBedrooms: #{@bedrooms}\tBathrooms: #{@bathrooms}\n"
+ end
end
diff --git a/05_Classes_Objects/starter_code/ex_apartment_objects/lib/building.rb b/05_Classes_Objects/starter_code/ex_apartment_objects/lib/building.rb
index 56c3dfb..4794270 100644
--- a/05_Classes_Objects/starter_code/ex_apartment_objects/lib/building.rb
+++ b/05_Classes_Objects/starter_code/ex_apartment_objects/lib/building.rb
@@ -1,4 +1,37 @@
#Building Class
class Building
+ attr_accessor :apartments, :num_units
+ attr_reader :address, :name
+
+ def initialize(name, address)
+ @name = name
+ @address = address
+ @apartments = []
+ end
+
+ def view_apartments
+ puts "-----------#{@name}-----------"
+ apartments.each do |unit|
+ puts unit
+ if unit.renter
+ puts "This apartment is rented"
+ else
+ puts "This apartment is vacant"
+ end
+ puts "*" * 50
+
+ end
+ end
+
+ def view_renters
+ puts "-----------#{@name} Renters List-----------"
+ apartments.each do |unit|
+ if unit.renter
+ puts "Name: #{unit.renter}\tApartment: #{unit.name}"
+ end
+ end
+ end
+
+
end
diff --git a/05_Classes_Objects/starter_code/ex_apartment_objects/lib/person.rb b/05_Classes_Objects/starter_code/ex_apartment_objects/lib/person.rb
index b7c1667..0c7f9fc 100644
--- a/05_Classes_Objects/starter_code/ex_apartment_objects/lib/person.rb
+++ b/05_Classes_Objects/starter_code/ex_apartment_objects/lib/person.rb
@@ -1,4 +1,16 @@
#Person Class.
class Person
+ attr_accessor :name, :credit_score, :gender
+
+ def initialize(name, credit_score, gender)
+ @name = name
+ @credit_score = credit_score
+ @gender = gender
+ end
+
+ def to_s
+ "#{@name}"
+ end
+
end
diff --git a/05_Classes_Objects/starter_code/ex_apartment_objects/main.rb b/05_Classes_Objects/starter_code/ex_apartment_objects/main.rb
index 246352e..18d37db 100644
--- a/05_Classes_Objects/starter_code/ex_apartment_objects/main.rb
+++ b/05_Classes_Objects/starter_code/ex_apartment_objects/main.rb
@@ -10,6 +10,7 @@
require_relative 'lib/building'
require_relative 'lib/apartment'
require_relative 'lib/person'
+require "pry"
## First, define our methods
@@ -83,11 +84,13 @@ def create_building
end
end
-puts "What would you like to do next, (v)iew all apartments? (q)uit?"
+puts "What would you like to do next, (v)iew all apartments? view all (r)enters? (q)uit?"
response = gets.strip
if response == 'v'
building.view_apartments
+elsif response == 'r'
+ building.view_renters
else
puts "Thanks for using Ruby Building Manager"
end
diff --git a/11_Lab_Session/slides/slides_11.md b/11_Lab_Session/slides/slides_11.md
index 3a6648a..227e874 100644
--- a/11_Lab_Session/slides/slides_11.md
+++ b/11_Lab_Session/slides/slides_11.md
@@ -1,40 +1,40 @@
-
-
-#BEWD - Review Lab Session
-
-###Instructor Name
-
----
-
-
-##Agenda
+
+
+#BEWD - Review Lab Session
+
+###Instructor Name
+
+---
+
+
+##Agenda
* Review
* Lab Time
----
-
-
+---
+
+
##Review
###Request-response

-
----
-
-
+---
+
+
+
##Review
###Routes, Views, Controllers and Forms
Instructors, you know your class best. What do your students need to review?
-
+
---
-
+
##Lab Time
####Ritly
@@ -42,13 +42,13 @@ Instructors, you know your class best. What do your students need to review?
####Rewsly
45 min
-
+
---
-
-## Homework
+
+## Homework
Complete Rewsly
-
+
---
-
+
diff --git a/12_Authentication/slides/slides_12.md b/12_Authentication/slides/slides_12.md
index 59fe4cf..059c9b8 100644
--- a/12_Authentication/slides/slides_12.md
+++ b/12_Authentication/slides/slides_12.md
@@ -1,278 +1,278 @@
-
-
-
-https://github.com/plataformatec/devise#getting-started
-
-
-#BEWD - Authentication
-
-###Instructor Name
-
-
----
-
-
-##Agenda
-
-* Review
- * Rewsly Solution
- * Rity Solution (Briefly)
-* Authentication
- * Authentication Explained
- * Devise Gem
-* Lab
- * Authenticated Ritly
-
----
-
-
-##Review
-###Rewsly & Ritly
-
-* Let's review Rewsly solution from last class.
-* Since we're going to work on Ritly, let's review that (briefly) as well.
-
----
-
-
-##Authentication
-
-
-
----
-
-
-##Authentication
-
-* Use of a combination of username and password to validate user identity. (Obvious I know…)
-* Tracking a user's identity on our app through the __session__.
-
----
-
-##Authentication
-###Security
-
-
-
----
-
-##Security
-* Can I view users' passwords in my app?
-
-####NO!
-
----
-
-##Security
-###Storing Passwords
-
-Bad practice to keep passwords in “clear text”
-
-* Passwords can't be stored in plain text in your database.
-If your database is compromised then passwords are compromised as well.
- * Don't use the same password for all sites.
-
----
-
-
-##Security
-###Hashing
-
-Use one way hash
-
-```
-Digest::SHA2.hexdigest("secret")
-# => "e5e9fa1ba31ecd1ae84f75caaa474f3a663f05f4"
-```
----
-
-
-##Security
-###Adding Salt
-
-Salt is random data that are used as an additional input to a one-way function that hashes a password.
-
-
-```
-salt = "a761ce3a45d97e41840a788495e85a70d1bb3815"
-password = "secret"
-Digest::SHA2.hexdigest(salt+password)
-# =>"7963ca00e2e48ea80c615d037494de00a0964682"
-```
-
----
-
-
-##Authentication
-###Managing Users
-
-* When the user is authenticated we store the user_id in the __session__.
-
----
-
-
-##Managing Users
-###Session
-
-* Session data commonly includes the browser user’s identity (name, login, shopping cart, etc.).
-
-* To work, the web server must uniquely identify each browser’s particular HTTP requests while the session lasts.
-
-* Commonly, web servers identify browsers by asking them to store a __cookie__.
-
----
-
-##Managing Users
-###Cookie
-
-* Used to store small bits of information (maximum size about 4k).
-* Cookies allow web servers to provide a temporary unique ID to a browser, to enable session management.
- * Browser storage is not secure.
- * Sensitive data (credit card numbers, etc.) should never be set in a cookie
-
----
-
-
-##Authentication
-###Gems
-Creating authentication from scratch is a complex process (see resources for more info). However Developers have created Gems to make authentication "easy".
-
-* __Devise__
-* CanCan
-* Clearance
-* OmniAuth
-* DoorKeeper
-
----
-
-
-##Authentication
-###Devise GEM
-[https://github.com/plataformatec/devise](https://github.com/plataformatec/devise)
-
-* Straight-forward to implement, integrate and customize.
-* Handles complex security, so you don't have to.
-* Provides controller filters and view helpers (more on that in the code along).
-* Recently updated (v3.0.0) with Rails 4 support!
-
-
----
-
-
-
-
-##Rewsly - Adding Devise
-
----
-
-
-##Devise
-###Recap
-
-* Adding Devise Gem to the Gemfile
-
- gem 'devise', '~> 3.0.0'
-
----
-
-
-##Devise
-###Recap
-
-* Using Devise
-
- rails g devise:install # creates all the devise Controllers, views and initializers
- rails g devise user # creates User model (or modifies it if it exists)
- rake db:migrate # Let's Go!
-
-
----
-
-
-##Devise
-###Recap
-
-* View helpers
-
- <%= user_is_logged_in? %>
- <%= current_user %>
-
----
-
-
-##Authentication
-###Recap
-
-* View helpers
-
- <%= user_is_logged_in? %>
- <%= current_user %>
-
----
-
-##Devise
-###Recap
-
-* Blocking Access
-
- class ApplicationController ...
- before_action :authenticate_user!
- end
-
- class HomeController < ApplicationController
- skip_before_action :authenticate_user!
- end
-
----
-
-##Devise
-###Recap
-
-* Changing the default Route names
-
- devise_for :users, :path_names => { sign_in: 'login', sign_out: 'logout' }
-
----
-
-
-
-##Lab Time - Authenticated Ritly
-
----
-
-
-## Homework
-
-Write a list of information/data you want to store about your user.
-
----
-
-
-