View owl.rb
1 2
require 'zlib'
frames = ["x\x9C\xED\x9C\xDDu\xDB0\f\x85\xDF\xBBB^2\x82e\xC9\x8Eu2Jf\xC8\x0E\x9D\xA2\x03v\x92\xBA'\x16e\e\xBC\x10\b\xD2\x14m\xDD\x97\x9E^#\x92h\x88\xF8\x00\xFE\xF9\xED\xAB\x1F?\x87\xF1\xFB\xFD\xEDk\xF7\xFDFAA\xB1e\xF1k\xFD&PPP\xB4\"\b\x04\n\n\n\x02\x81\x82\x82\x82@\xA0\xA0\xA0 \x10(((\b\x04\n\n\n\x02\x81\x82\x82\x82@\xA0\xA0\xA0 \x10(((\b\x04\n\n\n\x02\x81\x82\x82\x82@\xA0\xA0\xA0 \x10(((\b\x04\n\n\n\x02\x81\x82\x82\x82@\xA0\xA0\xA0hDl\e\b\xA7\xCF\xC3\xE7xX\xBD\x19\x8D\tz\x85bsh\xF8\xE9\xF4\xA1\xF3\xFF\xFD\xF3\xFB\xCA\xD0\x9D\xFF\x1D.\xFF\xB93\x1D\xF6?\x96\xC3\xFE\xCA\xB0\xFE\xD7\xA1\xDB(Z\x16[\x80\xCB]\x1E\xBD\x0E\x15\x19\x10\xDD\xA9\xFB1\xED\xFBN\x98\xA60:\xA10\xEA\x86\xC3m\x1C]bkm\x17<\xD4\x87'\xE9(\xEC\xC3\xE1\x10\xF3\xD4\xF5\xFD\x8E\x1F\xD2\x85,\x836\"^\x9EG\xC6D-b\xEA\x1CJ(\xA6\x14\x93\x82\xAC9\x121\xCD\x04\x1D\xA7\x96\xDF\x94\v:P\xB3,\xBB\xBE\xE45\xD02\x1E\x81\anXd2\x88w\xEA\xC2\xA4\xF3m\xE3Wz\xFCHi\xF7\xFAaBA\xC6\xB6\x8B\xD5LS\x04\xC6\x13\xA7#A\xDDC\x84\x8F\xB0\x96R\xCA\xAC3\x05\x01\xF4
View dispatcher_assessment.md

Looked at the winning Dispatcher. Yours is better, b/c you can take it all by itself. Here are some examples of totally reasonable requirements that would feasibly be required of this application, in the real world. The winning one can't handle them without a refactoring like what we did:

Speed up the algorithm

View big_picture.md

Rails

  • How does the web work
    • Browser creates a visual representation of a server's response (usually parsing an HTML string and rendering it)
    • Browser finds the server by looking up the name (eg google.com) in DNS to get an IP Address (216.58.217.46)
    • ping google.com
    • The machine has many programs running, they identify which one should handle it by looking at the port (eg 3000, or 80)
    • The operating system sends the HTTP request to whatever program is registered on that port, this is the server, WEBrick
    • The server parses the request and hands it to the application, ie Rails.application
View sales_engine_active_record_mass_insertion.rb
1 2 3 4 5 6 7 8 9 10
# s_arb
require 'active_record'
ActiveRecord::Base.establish_connection adapter: 'sqlite3', database: ':memory:'
 
ActiveRecord::Schema.define do
self.verbose = false
create_table :customers do |t|
t.string :first_name
t.string :last_name
View sales_engine_active_record.rb
1 2 3 4 5 6 7 8 9 10
# https://github.com/JoshCheek/playgrounds <-- lots of examples (params, routes, etc)
# https://gist.github.com/JoshCheek/985a70527fa11a0123c5 <-- we got mass insertion working!
# s_arb <-- set language to ruby, then type that and press tab!
require 'active_record'
ActiveRecord::Base.establish_connection adapter: 'sqlite3', database: ':memory:'
 
ActiveRecord::Schema.define do
self.verbose = false
create_table :customers do |t|
View sales_engine.md

Sales Engine

Due

3pm on Tuesday, May 12th

Pairs

View object_model_challenges.rb
1 2 3 4 5 6 7 8 9 10
# Run these with `command + option + n`, NOT `b`
 
 
# ===== Toplevel methods are defined where? =====
def rawr!
"#{self} says: rawr!"
end
public :rawr!
 
# *****
View router.rb
1 2 3 4 5 6 7 8 9 10
class Route
def initialize(route)
@route = route
end
 
def to_s
string = ""
string << "#{verb} request to #{path} will dispatch to the class #{controller.camelize}, and call the method #{action}.\n"
string << "#{controller.camelize} is expected to be defined in #{controller_file}\n"
string << "There are #{helper_methods.length} helper methods you can call in the controller and the view: #{helper_methods}\n" if helper_methods.any?
View rails_d3_routing_visualizer.rb
1 2 3 4 5 6 7 8 9 10
require 'action_dispatch/routing'
require 'json'
 
routes = ::ActionDispatch::Routing::RouteSet.new
routes.draw do
namespace :admin do
resources :users
end
resources :ducks do
member do
View rails_sib.rb
1 2 3 4 5 6 7 8 9
gem 'rails', '4.2.1' # prob works on others, too, but this is the one I figured it out on
require "rails"
require 'active_record'
require 'action_controller/railtie'
require 'action_view/railtie'
 
# ===== Configuration =====
Rails.logger = ActiveRecord::Base.logger = Logger.new $stdout
ActiveSupport::LogSubscriber.colorize_logging = false
Something went wrong with that request. Please try again.