Skip to content

Instantly share code, notes, and snippets.

View kenmazaika's full-sized avatar

ken mazaika kenmazaika

View GitHub Profile
class Node
attr_accessor :value, :next_node
def initialize(value, next_node)
@value = value
@next_node = next_node
end
def print_values
print "#{self.value}-->"
class Node
attr_accessor :value, :next_node, :prev_node
def initialize(value, next_node, prev_node)
@value = value
@next_node = next_node
@prev_node = prev_node
end
end
irb(main):005:0> def convert_my_number(output_type)
irb(main):006:1> ^C
irb(main):006:0> my_num.to_s
=> "29"
irb(main):007:0> my_num.send(:to_s)
=> "29"
irb(main):008:0> method = :to_s
=> :to_s
irb(main):009:0> method
=> :to_s
def update
@workout_drill = WorkoutDrill.find(params[:id])
@workout_drill.update_attributes(workout_drill_params)
next_drill = @workout_drill.next_drill # TODO: add this method, a la flixter's next_lesson
redirect_to workout_drill_path(next_drill)
end
def show
@workout_drill= WorkoutDrill.find(params[:id])
end
require 'minitest/autorun'
class ManhattanDistance
# given a distance, calculate all possible move
# possibilities a certain manhattan distance away
def self.touples(n)
return [] if n == 0
list = []
puts "Hello"
#!/usr/bin/env ruby
class Coffee
attr_accessor :size, :blend, :temperature
def initialize(size, blend="house", temperature="hot")
@size = size
@blend = blend
@temperature = temperature
end
18:11:47 From aaronwashburn : Per Ken’s suggested I did
18:11:53 From Marco Morawec : https://docs.google.com/document/d/1DSo0bHUAGE8kppmwGVTIVdsP6C2WiNWnnOEIFL9pJtQ/edit?usp=sharing
18:12:16 From aaronwashburn : has_many :collaborating_clients, :through :collaborations, :source => :client
18:12:56 From aaronwashburn : This gave me all clients but in 2 variables. Any way to combine those into just one call or am I back to combining them as an array?
18:14:56 From Mal : By “2 variables”, do you mean “clients” and “collaborating_clients”?
18:15:30 From aaronwashburn : Yes, with Ken’s suggestions I get @user.clients and @user.collaborating_clients. I would love to access them as I call.
18:15:39 From aaronwashburn : as one call....
18:19:49 From Marco Morawec : flixter/app/assets/views/instructor/courses/new.html.erb
<%= simple_form_for @course, :url => instructor_courses_path do |f| %>