Skip to content

Instantly share code, notes, and snippets.

@Leejojo
Leejojo / js-betting-game
Created July 25, 2016 22:17
js-betting-game
<!DOCTYPE html>
<html>
<head>
<script src="jquery-3.1.0.js"></script>
</head>
<body>
<h1>Place Your Bets!</h1>
@Leejojo
Leejojo / arrayOfLights
Created July 25, 2016 16:59
arrayOfLights
function arrayOfLight(x) {
for (var i = 0; i <= x; i++){
console.log(i)
}
}
@Leejojo
Leejojo / employee.rb
Created July 6, 2016 20:07
Stores & Employees (CR)
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
@Leejojo
Leejojo / bookstore.sql
Created July 5, 2016 00:50
Bookstore SQL Assignment
#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
@Leejojo
Leejojo / Gemfile
Created June 29, 2016 23:45
Stubbing Review
gem 'rspec'
gem 'pry'
gem 'byebug'
@Leejojo
Leejojo / 1_hello_world.rb
Created June 29, 2016 22:47
Debugging with Rspec
### SETUP
require 'rspec'
### LOGIC (fix me)
def who (word)
word
end
def hello(who)
"hello #{who}!"
@Leejojo
Leejojo / barracks.rb
Created June 29, 2016 00:07
Warcraft 3
class Barracks
attr_reader :gold, :food
def initialize
@gold = 1000
@food = 80
end
def train_footman
@Leejojo
Leejojo / contact.rb
Created June 28, 2016 15:29
Contact List App
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
@Leejojo
Leejojo / io exercise
Created June 27, 2016 17:08
I/O Excerises
require 'rubygems'
require 'rest-client'
fname = "sample.txt"
somefile = File.open(fname, "w")
somefile.puts "Hello file!"
somefile.close
@Leejojo
Leejojo / car.rb
Created June 27, 2016 15:14
Week 2, Day 1 Notes : CLASSES
class Car
def initialize(model, colour)
@model = model
@colour = colour
end
end