Skip to content

Instantly share code, notes, and snippets.

@smucode
smucode / html_parser.rb
Created February 9, 2012 12:55 — forked from jimweirich/html_parser.rb
Vital Ruby Advance Lab 2
require("nokogiri")
require("./url_fetcher")
class HtmlParser
def parse url
html = UrlFetcher.new.fetch url
Nokogiri::HTML(html).css('a').map{|e| parse_url(url, get_href(e)) }.compact
end
def get_href e
@smucode
smucode / proxy.rb
Created February 8, 2012 08:46 — forked from jimweirich/read_only_proxy.rb
Vital Ruby Lab 5
class Presentation
attr_accessor :title, :presenter
def initialize title, presenter
@title = title
@presenter = presenter
end
end
@smucode
smucode / presentation.rb
Created February 7, 2012 13:54 — forked from jimweirich/presentation.rb
Vital Ruby Lab 4
class Presentation
attr_accessor :title, :author, :scores
def initialize title, author
@title = title
@author = author
@scores = []
end
@smucode
smucode / x.rb
Created February 7, 2012 11:55 — forked from jimweirich/x.rb
Vital Ruby my_each
class Array
def xeach
i = 0
while i < self.size
yield self[i]
i += 1
end
end
@smucode
smucode / presentation.rb
Created February 7, 2012 08:21 — forked from jimweirich/presentation.rb
Vital Ruby Lab 3
class Pres
attr_accessor :what, :who
def initialize what, who, cat = "?"
@what = what
@who = who
@cat = cat
@scores = []