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
def hello | |
puts 'yo' | |
end | |
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
def hello | |
puts 'yo' | |
end |
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
# app/controllers/api/v1/employees_controller.rb | |
class Api::V1::EmployeesController < ApplicationController | |
def index | |
@employees = Employee.all | |
end | |
#... | |
end |
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
Rails.application.routes.draw do | |
namespace :api do | |
namespace :v1 do | |
get '/employees' => 'employees#index' | |
get '/employees/:id' => 'employees#show' | |
post '/employees' => 'employees#create' | |
patch '/employees/:id' => 'employees#update' | |
delete '/employees/:id' => 'employees#destroy' | |
end | |
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
# app/controllers/v1/employees_controller.rb | |
class V1::EmployeesController < ApplicationController | |
def index | |
@employees = Employee.all | |
end | |
#... | |
end |
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
Rails.application.routes.draw do | |
namespace :v1 do | |
get '/employees' => 'employees#index' | |
get '/employees/:id' => 'employees#show' | |
post '/employees' => 'employees#create' | |
patch '/employees/:id' => 'employees#update' | |
delete '/employees/:id' => 'employees#destroy' | |
end | |
namespace :v2 do |
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
json.array! @employees.each do |employee| | |
json.partial! 'employee.json.jbuilder', employee: employee | |
end |
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
@data = {"query"=>{"count"=>1, "created"=>"2016-04-03T15:59:05Z", "lang"=>"en-US", "results"=>{"channel"=>{"units"=>{"distance"=>"mi", "pressure"=>"in", "speed"=>"mph", "temperature"=>"F"}, "title"=>"Yahoo! Weather - Nome, AK, US", "link"=>"http://us.rd.yahoo.com/dailynews/rss/weather/Country__Country/*https://weather.yahoo.com/country/state/city-2460286/", "description"=>"Yahoo! Weather for Nome, AK, US", "language"=>"en-us", "lastBuildDate"=>"Sun, 03 Apr 2016 07:59 AM AKDT", "ttl"=>"60", "location"=>{"city"=>"Nome", "country"=>"United States", "region"=>" AK"}, "wind"=>{"chill"=>"14", "direction"=>"248", "speed"=>"11"}, "atmosphere"=>{"humidity"=>"80", "pressure"=>"1005.0", "rising"=>"0", "visibility"=>"16.1"}, "astronomy"=>{"sunrise"=>"8:8 am", "sunset"=>"10:3 pm"}, "image"=>{"title"=>"Yahoo! Weather", "width"=>"142", "height"=>"18", "link"=>"http://weather.yahoo.com", "url"=>"http://l.yimg.com/a/i/brand/purplelogo//uh/us/news-wea.gif"}, "item"=>{"title"=>"Conditions for Nome, AK, US at 06:00 AM AKDT", "la |
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
# 1. Write out the Card and Deck classes to make the program work. The Deck class should hold a list of Card instances. | |
# 2. Change the program to use multiple choice questions. The Card class should be responsible for checking the answer. | |
# 3. CHALLENGE: Change the program to allow the user to retry once if they get the wrong answer. | |
# 4. CHALLENGE: Change the program to keep track of number right/wrong and give a score at the end. | |
# 5. CHALLENGE: Change the program to give the user the choice at the end of the game to retry the cards they got wrong. | |
# 6. CHALLENGE: Change the interface with better prompts, ASCII art, etc. Be as creative as you'd like! | |
class Card | |
end |
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
AllCops: | |
DisabledByDefault: true | |
Layout/IndentationConsistency: | |
EnforcedStyle: indented_internal_methods | |
Layout/IndentationWidth: | |
Width: 2 | |
Style/MethodDefParentheses: |