This file contains hidden or 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
class UsersController < ApplicationController | |
before_action :set_user, except: [:index, :new, :create] | |
after_action :notify_channel, only: [:create, :update, :destroy] | |
def index | |
@users = User.all | |
end | |
def show | |
end |
This file contains hidden or 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
#Problem 1 | |
directions = ["north", "east", "south", "west"] | |
#Problem 2 | |
compass = { | |
n: "north", | |
e: "east", | |
s: "south", | |
w: "west" | |
} |
This file contains hidden or 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 "resque/tasks" | |
require "./screenshot_grabber.rb" |
This file contains hidden or 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
class BankAccount | |
@@default_minimum = 3.50 | |
attr_reader :minimum_balance | |
def initialize(amount, account_holder) | |
@minimum_balance = @@default_minimum | |
if amount >= @@default_minimum | |
@balance = amount | |
else | |
raise ArgumentError |
This file contains hidden or 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
class UrlParser | |
attr_reader :scheme, :domain, :port, :path, :query_string, :fragment_id | |
def initialize(url) | |
@url_remaining = url | |
@scheme = parse_url("://") | |
post_domain_char = @url_remaining[@url_remaining.index("/")+1] | |
if @url_remaining.include?(":") | |
@domain = parse_url(":") | |
@port = parse_url("/") |
This file contains hidden or 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 'httparty' | |
class SiteCopier | |
include HTTParty | |
base_uri 'api.page2images.com' | |
def initialize(sites, key) | |
@sites = sites | |
@api_key = key | |
@screenshots = get_screenshots |
This file contains hidden or 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 'minitest/autorun' | |
class Scheduler | |
def initialize(time_array, meeting_length) | |
@time_array = time_array | |
@meeting_length = meeting_length | |
@free_time_hash = make_free_time_hash | |
end |
This file contains hidden or 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_relative 'flight_planner' | |
def test_code(flight_planner_instance) | |
planner = flight_planner_instance | |
tests = [ | |
[:can_i_fly?, ["MIA", "JFK"], true], | |
[:can_i_fly?, ["MIA", "ORD"], false], | |
[:can_i_fly?, ["MIA", "XXX"], false], | |
[:can_i_fly?, ["PHX", "AUX"], false], | |
[:can_i_fly?, ["FLL", "WPB"], true] |
This file contains hidden or 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 "csv" | |
class Mailer | |
def send_email(name, email_address) | |
if email_address.strip.end_with? "securedomain.net" | |
@attempts_to_secure = @attempts_to_secure ? @attempts_to_secure+1 : 1 | |
if @attempts_to_secure < 2 | |
return false | |
end | |
end |
This file contains hidden or 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 max(items) | |
max_num = items[0] | |
items.slice(1, items.length-1).each do |num| | |
if (num > max_num) | |
max_num = num | |
end | |
end | |
max_num | |
end |
NewerOlder