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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="jquery-3.1.0.js"></script> | |
</head> | |
<body> | |
<h1>Place Your Bets!</h1> | |
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
function arrayOfLight(x) { | |
for (var i = 0; i <= x; i++){ | |
console.log(i) | |
} | |
} |
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
class Employee < ActiveRecord::Base | |
belongs_to :store | |
validates :first_name, presence: true | |
validates :last_name, presence: true | |
validates :hourly_rate, numericality: { greater_than: 40, less_than: 3000 } | |
validates :store_id, presence: true | |
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
#1 | |
SELECT editions.isbn | |
FROM editions | |
INNER JOIN publishers | |
ON (editions.publisher_id = publishers.id) | |
WHERE (publishers.name = 'Random House'); | |
#2 | |
SELECT editions.isbn, books.title | |
FROM editions | |
INNER JOIN publishers |
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
gem 'rspec' | |
gem 'pry' | |
gem 'byebug' |
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
### SETUP | |
require 'rspec' | |
### LOGIC (fix me) | |
def who (word) | |
word | |
end | |
def hello(who) | |
"hello #{who}!" |
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
class Barracks | |
attr_reader :gold, :food | |
def initialize | |
@gold = 1000 | |
@food = 80 | |
end | |
def train_footman |
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 'csv' | |
# Represents a person in an address book. | |
# The ContactList class will work with Contact objects instead of interacting with the CSV file directly | |
class Contact | |
attr_accessor :name, :email | |
# Creates a new contact object |
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 'rest-client' | |
fname = "sample.txt" | |
somefile = File.open(fname, "w") | |
somefile.puts "Hello file!" | |
somefile.close |
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
class Car | |
def initialize(model, colour) | |
@model = model | |
@colour = colour | |
end | |
end |
NewerOlder