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 'socket' # Get sockets from stdlib | |
require 'json' | |
require 'active_support/all' | |
require 'active_record' | |
ActiveRecord::Base.logger = Logger.new(STDERR) | |
ActiveRecord::Base.establish_connection( | |
:adapter => 'sqlite3', | |
:database => 'project_db' |
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 'socket' # Get sockets from stdlib | |
require 'json' | |
require 'active_support/all' | |
require 'active_record' | |
ActiveRecord::Base.logger = Logger.new(STDERR) | |
ActiveRecord::Base.establish_connection( | |
:adapter => 'sqlite3', | |
:database => 'project_db' |
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
#!/usr/bin/env/ ruby | |
require_relative('fp') | |
require 'sinatra' | |
require 'json' | |
t = FlightTracker.new | |
get '/' do |
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 Hack | |
def initialize words | |
@words = words.downcase.split(/\/|\s|,\s|\,/) | |
@splitwords = [] | |
@words.each { |w| @splitwords << w.split('') } | |
show_likely | |
end | |
def deduct |
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 'active_record' | |
ActiveRecord::Base.logger = Logger.new(STDERR) | |
ActiveRecord::Base.establish_connection( | |
:adapter => 'sqlite3', | |
:database => 'dbfile_example' | |
) | |
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
def all_times employees | |
employees.collect {|employee| employee[:time_working]} | |
end | |
def helped_by cust_num, employees | |
employees.each do |employee| | |
if employee[:cust_helped].include? cust_num | |
puts "#{employee[:name].capitalize} helped customer ##{cust_num}." | |
puts "\n" | |
end |
NewerOlder