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
# Run if necessary: | |
# RubyVM::InstructionSequence.compile_option = { | |
# tailcall_optimization: true, | |
# trace_instruction: false | |
# } | |
class FizzBuzz | |
def self.find_answers_for(max) | |
self.new(max).find_answers_for([], 1) | |
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 FizzBuzz | |
def self.find_answers_for(max) | |
self.new.find_answers_for(max) | |
end | |
def find_answers_for(max) | |
1.upto(max).map do |current| | |
[find_result_hash(current), current] | |
.find { |result| result != '' } | |
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 FizzBuzz | |
def self.find_answers_for(max) | |
1.upto(max).each do |n| | |
result = '' | |
result << 'Fizz' if n % 3 == 0 | |
result << 'Buzz' if n % 5 == 0 | |
result = n if result.empty? | |
result | |
end | |
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 FizzBuzz | |
def self.find_answers_for(max) | |
self.new.find_answers_for(max) | |
end | |
def initialize | |
@result = [ | |
Proc.new do |x| x; end, | |
Proc.new do |x| x; end, | |
Proc.new do |x| "Fizz"; 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
defmodule ProductVehicle do | |
def vehicles_that_fit_product(query \\ ProductVehicle, product_id) do | |
query | |
|> join(:inner, | |
[products_vehicles], | |
product in assoc(products_vehicles, :product)) | |
|> join(:inner, | |
[products_vehicles], | |
vehicle in assoc(products_vehicles, :vehicle)) | |
|> join(:inner, |
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
defmodule ProductVehicle do | |
def vehicles_that_fit_product(query \\ ProductVehicle, product_id) do | |
query | |
|> join(:inner, | |
[products_vehicles], | |
product in assoc(products_vehicles, :product)) | |
|> join(:inner, | |
[products_vehicles], | |
vehicle in assoc(products_vehicles, :vehicle)) | |
|> join(:inner, |
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
defmodule ProductVehicle do | |
def vehicles_that_fit_product(query \\ ProductVehicle, product_id) do | |
query | |
|> join(:inner, | |
[products_vehicles], | |
product in assoc(products_vehicles, :product)) | |
|> join(:inner, | |
[products_vehicles, _product], | |
vehicle in assoc(products_vehicles, :vehicle)) | |
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
defmodule ProductVehicle do | |
def vehicles_that_fit_product(query \\ ProductVehicle, product_id) do | |
query | |
|> join(:inner, | |
[products_vehicles], | |
product in assoc(products_vehicles, :product)) | |
|> join(:inner, | |
[products_vehicles], | |
vehicle in assoc(products_vehicles, :vehicle)) | |
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
defmodule VehicleMake do | |
schema "vehicle_makes" do | |
field :name, :string | |
has_many :vehicle_models, VehicleModel | |
has_many :vehicles, through: [:vehicle_models, :vehicles] | |
end | |
end | |
defmodule VehicleModel 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
April 11, 2016 | |
10:15 - Salon A David Ferrucci: Salon A - AI: A Return to Meaning | |
11:30 - Salon D James Roper: Rethinking REST in a Microservices World | |
13:30 - Salon C Yehuda Katz: Stability Without Stagnation: Lessons Learned Shipping Ember | |
14:45 - Salon A Evan Chan: NoLambda: A new architecture combining streaming, ad hoc, machine learning, and batch analytics | |
16:00 - Salon D Jean Yang: Securing Software by Construction | |
April 12, 2016 | |
08:45 - Salon D Bryan Helmkamp: Code Quality in Practice | |
10:15 - Salon A Raffi Krikorian: How Your Organization is Killing your Software |