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
######################## | |
# NYC PIGEON ORGANIZER # | |
######################## | |
# Start with the following collected data on NYC pigeons. | |
pigeon_data = { | |
:color => { | |
:purple => ["Theo", "Peter Jr.", "Lucky"], | |
:grey => ["Theo", "Peter Jr.", "Ms .K"], |
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
"Which SQL command selects all the columns from the sable?" | |
SELECT * | |
SELECT all | |
SELECT rows | |
SELECT every_one_of_them | |
"Which SQL command is used to sort the result-set?" | |
SORT | |
ARRANGE | |
SORT_BY |
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 Jukebox | |
attr_accessor :songs, :desire, :current_song #:song_hash | |
def initialize(songs) | |
@songs = songs | |
#@song_hash = {} | |
help | |
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
class Student | |
attr_accessor :name, :twitter, :linkedin, :facebook, :website | |
attr_reader :id | |
@@students = [] | |
def initialize | |
@@students << self | |
@id = @@students.count | |
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
class School | |
attr_accessor :name, :roster | |
def initialize(name) | |
@roster = {} | |
@name = name | |
end | |
def add_student(student_name, grade) |
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 'simplecov' | |
SimpleCov.start | |
require 'json' | |
require 'rspec' | |
require_relative 'jukebox' | |
require_relative 'song' | |
RSpec.configure do |config| | |
# Use color in STDOUT |
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 'sqlite3' | |
require 'pry' | |
class Student | |
attr_accessor :name, :twitter, :linkedin, :facebook, :website, :saved, :id | |
@@db = SQLite3::Database.new 'students.db' | |
@@students = [] |
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 'sqlite3' | |
require 'pry' | |
class Student | |
attr_accessor :name, :twitter, :linkedin, :facebook, :website, :saved, :id | |
@@db = SQLite3::Database.new 'students.db' | |
@@students = [] |
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
# Download this file: | |
# https://gist.github.com/aviflombaum/28534c5d69edd2439a7d/download | |
# Run it from your terminal with: | |
# ruby ruby.basics.rb | |
# (Just make sure you are in the right directory) | |
# ====================================== | |
# Ignore All This Code | |
# ====================================== |
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
# **Tweet Shortener | |
# A client has hired you to automatically post some of their brand | |
# messages to twitter, but the problem is that some of them are too | |
# long. Your job is to shorten them by replacing longer words with | |
# shorter representations (i.e. "two" becomes "2"). | |
# Write a method that will take a tweet, search it for words that you | |
# can substitute, and return a substituted string tweet. For instance, | |
# the tweet "Hello to you, I'm at home" would become "Hi 2 u, I'm @ |