Skip to content

Instantly share code, notes, and snippets.

@kblake
kblake / about.md
Created August 11, 2011 05:45 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
# 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
# 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
# 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"
##############################################################################
# Add specs here to help drive functionality in the Post class
#post_spec.rb
require 'post'
describe Post do
it "should exist :)" do
@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)
# 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
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
require 'rubygems'
require 'pivotal-tracker'
require 'highline/import'
HighLine.track_eof = false
def story_filter(chosen_state)
lambda {|story| story.owned_by == @name && story.current_state == chosen_state}
end
require 'rubygems'
require 'twitter'
require 'highline/import'
username = ask("Please enter twitter name")
unless username.empty?
size = 50 #limit to 50 followers arbitrarily