Skip to content

Instantly share code, notes, and snippets.

require 'rubygems'
require 'highline/import'
require 'highline_menus_methods' #method definitions defined in external file
line = "="*72
puts line
say "Welcome to my math program"
#highline menu stuff...
loop do #setup infinite loop
# Objective:
# Rewrite each of the methods, espressions or statements into more into better
# readable and idiomatic Ruby code
def getDnaLab(lab_name)
DnaLab.all.each do |lab|
if lab.name == lab_name
return lab
end
@kblake
kblake / post.rb
Created September 24, 2010 20:19
# post.rb ############
module Commentable
attr_accessor :comments
def setup_comments
@comments ||= []
end
def add_comment(comment)
##############################################################################
# Add specs here to help drive functionality in the Post class
#post_spec.rb
require 'post'
describe Post do
it "should exist :)" do
# The goal is take type specific conditionals out of a class and use polymorphism to let each class handle their own responsibilities
class Animal
def initialize(type)
@type = type
end
def eat
"eating... nom nom"
# Objective:
# Rewrite each of the methods, espressions or statements into better
# readable and idiomatic Ruby code
def getDnaLab(lab_name)
DnaLab.get_all.each do |lab|
if lab.name == lab_name
return lab
end
# Write the tag class and the methods to make the specs pass
describe Tag do
def tag(name, options = {})
Tag.new(name, options).show
end
it "instantiate itself" do
Tag.new(:p).should_not be_nil
@kblake
kblake / about.md
Created August 11, 2011 05:45 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@kblake
kblake / bling.css
Created February 8, 2012 18:01
bling - your wildest imaginations come true
.bling { color: golden; border: 1px solid sparkle; }
@kblake
kblake / gist:1810854
Created February 12, 2012 21:08 — forked from maxim/gist:1810525
>> foo = proc { bar }
=> #<Proc:0x0000000101c444b8@(pry):1>
>> foo.call
NameError: undefined local variable or method `bar' for #<Object:0x1001dc288>
from (pry):1
>> def bar
>> "bar"
>> end