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
| teams = { | |
| thebest: { | |
| colors: ["orange","purple"], | |
| players:{ | |
| don: { | |
| number: 1, shoe_size: 9, points: 5, rebounds: 6, assists: 7, steals: 8, blocks: 9, slam_dunks: 10 | |
| }, | |
| jon: { | |
| number: 2, shoe_size: 8, points: 6, rebounds: 7, assists: 8, steals: 9, blocks: 10, slam_dunks: 11 |
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
| teams = { | |
| thebest: { | |
| colors: ["orange","purple"], | |
| players:{ | |
| don: { | |
| number: 1, shoe_size: 9, points: 5, rebounds: 6, assists: 7, steals: 8, blocks: 9, slam_dunks: 10 | |
| }, | |
| jon: { | |
| number: 2, shoe_size: 8, points: 6, rebounds: 7, assists: 8, steals: 9, blocks: 10, slam_dunks: 11 |
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
| -- SQL Basic Syntax -- | |
| --initialize SQLite database w/ command line: | |
| sqlite3 database_name.db | |
| --helpful commands | |
| .help -- list of commands | |
| .tables -- see all tables | |
| .mode column / .header on -- helpful for viewing |
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 Anagram | |
| attr_accessor :word | |
| def initialize(word) | |
| @word = word | |
| end | |
| def match(array) | |
| @word = @word.split("").sort | |
| array.select { |element| element.split("").sort == @word } |
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 Jukebox | |
| attr_accessor :songs | |
| DefaultSongs = [ | |
| "The Phoenix - 1901", | |
| "Tokyo Police Club - Wait Up", | |
| "Sufjan Stevens - Too Much", | |
| "The Naked and the Famous - Young Blood", | |
| "(Far From) Home - Tiga", | |
| "The Cults - Abducted", |
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 School | |
| attr_reader :roster,:school | |
| def initialize(school) | |
| @school = school | |
| @roster = {} | |
| end | |
| def roster | |
| @roster |
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 TriangleError < Exception | |
| end | |
| class Triangle | |
| attr_reader :side1, :side2, :side3 | |
| def initialize(side1, side2, side3) | |
| @side1 = side1 | |
| @side2 = side2 | |
| @side3 = side3 |
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 is_a_vowel?(v) | |
| 'aeiou'.include?(v) | |
| 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
| class Integer | |
| @@roman_numerals = { | |
| 1000 => "M", | |
| 900 => "CM", | |
| 500 => "D", | |
| 400 => "CD", | |
| 100 => "C", | |
| 90 => "XC", | |
| 50 => "L", | |
| 40 => "XL", |
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 initialize(attributes) | |
| attributes.each do |attribute, value| | |
| self.class.send(:define_method, attribute) do | |
| @attribute = value | |
| end | |
| end | |
| end | |
| end |