Skip to content

Instantly share code, notes, and snippets.

@iande
iande / gist:989971
Created May 24, 2011 23:09
Blah blah STI
class Result
# Possible attributes:
# seller_name: String, nil
# title : String, nil
# description: String
# price : Decimal
def human_readable_on_base
str = if self.title
"#{self.title} "
@iande
iande / gist:959065
Created May 6, 2011 14:47
First Stab @ package_error
package_error()
{
local _message=$1
if [[ -z "${_message}" ]]
then
fail "Cannot print a package error as no message was provided."
fi
local _log=$2
if [[ -n ${_log} ]] && file_exists ${_log}
@iande
iande / dragnet example.rb
Created April 10, 2011 21:49
Example dragnet DSL - First Draft
result_objects = Google.search("something") do |results|
results.map do |link|
obj = build_object ...
obj.title = link.content
obj.url = link.href
get(link.href) do |doc|
obj.description = doc['div#desc'].content
...
end
class Page < Ohm::Model
attribute :name
attribute :html
list :blocks, BlockContent
index :name
def validate
assert_present :name
end

Nokogiri Parser Comparisons

Author: Ezekiel Templin
Date: February 06, 2011
Summary: Comparing Nokogiri's parsers

System Information

Operating System:    Mac OS X 10.6.6 (10J567)

CPU: Intel Core i7 2.66 GHz