This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rubygems" | |
require "rack" | |
require "middleman/rack" | |
require "rack/contrib/try_static" | |
protected_middleman = Rack::Auth::Basic.new(Middleman.server) do |username, password| | |
[username, password] == [ENV['HTTP_USERNAME'], ENV['HTTP_PASSWORD']] | |
# Enable proper HEAD responses | |
use Rack::Head |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Exploring methods | |
def introduce(first_name, last_name) | |
puts "Hello! My name is #{first_name} #{last_name}." | |
end | |
# Ruby creates local variables called first_name and last_name and | |
# assigns the inputs (or arguments) into them |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Accessing hashes and arrays | |
# Create a set of hashes like below: | |
student1 = { "first" => "Neal", "last" => "Sales-Griffin", "hometown" => "Chicago" } | |
student2 = { "first" => "Mike", "last" => "McGee", "hometown" => "Freeport" } | |
student3 = { "first" => "Jeff", "last" => "Cohen", "hometown" => "Skokie" } | |
student4 = { "first" => "Raghu", "last" => "Betina", "hometown" => "Goshen" } | |
student5 = { "first" => "Vince", "last" => "Cabansag", "hometown" => "Sturgis" } |