Skip to content

Instantly share code, notes, and snippets.

@katieblair
katieblair / guess_the_number_js.js
Last active August 29, 2015 14:02
Guess the number game in Javascript
// index.html
<!DOCTYPE html>
<html>
<head>
<title>Guess the Number</title>
</head>
<body>
<script src="guess_the_number.js"></script>
@katieblair
katieblair / getters2.rb
Created June 6, 2014 12:43
Second getters example from Apollo
class Card
def initialize(rank, suit)
@suit = suit
@rank = rank
end
def suit
@suit
end
@katieblair
katieblair / getters.rb
Created June 6, 2014 12:42
Getters example from Apollo
class Car
def initialize(color, owner, cylinders)
@color = color
@owner = owner
@cylinders = cylinders
end
def color
@color
end
@katieblair
katieblair / constructor2.rb
Created June 5, 2014 17:49
Apollo constructor challenge #2
class Television
def initialize(size, type)
@size = size
@type = type
end
end
@katieblair
katieblair / constructor.rb
Created June 5, 2014 17:43
Apollo constructor challenge
class Card
def initialize(rank = nil, suit = nil)
if suit.nil? && rank .nil?
@suit = ['♠', '♣', '♥', '♦'].sample
else
@suit = suit
end
@rank = rank
puts "Create a new card: #{@rank} of #{@suit}"
end
@katieblair
katieblair / Blackjack
Last active August 29, 2015 14:02
Blackjack
require 'pry'
RANK = ['2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K', 'A']
SUIT = ['♠', '♥', '♣', '♦']
class Card
attr_reader :card
#represent an individual playing card. This class should
#contain the suit and the value and provide methods for
require 'pry'
class Mortgage
attr_reader :home_value, :down_payment_percentage, :apr, :duration_in_years
def initialize(home_value, down_payment_percentage, apr, duration_in_years)
@home_value = home_value
@down_payment_percentage = down_payment_percentage
@apr = apr
@duration_in_years = duration_in_years
#1
SELECT title, rating FROM movies ORDER BY rating ASC LIMIT 50;
#2
SELECT title FROM movies WHERE rating IS NULL ORDER BY title;
#3
SELECT title FROM movies WHERE synopsis LIKE '%thrilling%';
#4
<!DOCTYPE html>
<html lang="en">
<head>
<title>Kickball Teams</title>
<link rel="stylesheet" href="home.css" />
</head>
<body>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Kickball Teams</title>
<link rel="stylesheet" href="home.css" />
</head>
<body>
<h1>Kickball Teams</h1>