Skip to content

Instantly share code, notes, and snippets.

View brapse's full-sized avatar

Sean Braithwaite brapse

View GitHub Profile
(define (A x y)
(cond ((= y 0) 0)
((= x 0) (* 2 y))
((= y 1) 2)
(else (A (- x 1)
(A x (- y 1))))))
;;manual
(A 2 4)
(A 1 (A 2 3))
(A 1 (A 1 (A 2 2)))
== trample.rb ==
Trample.configure do
concurrency 20
iterations 10
base = "http://test.smarthippo.com/search/data.js"
args = {:reason => 0,
:zip_code => 90210,
:mortgage_product => "FIXED-30",
:property_value => 400_000,
admin@temp:~/current$ RAILS_ENV=lab rake gems:build
(in /mnt/apps/html/smarthippo-webapp/releases/20090827222939)
Missing these required gems:
hpricot
You're running:
ruby 1.8.7.72 at /usr/bin/ruby1.8
rubygems 1.3.1 at /home/admin/.gem/ruby/1.8, /var/lib/gems/1.8
Run `rake gems:install` to install the missing gems.
Hipdoop::adapt(:name => "National City", :cert => 6557) do
url = 'http://www.nationalcityhomeloans.com/QuickRates/QuickRates.aspx?AppType=1&LoanAmount=250000&ZipCode=90210'
document = fetch_document(url)
table = Hipdoop::Table.new('table.rateSection:nth(0)', document)
emit 'FIXED-10', table[2][1], :ltv_max => 0.75
emit 'FIXED-15', table[3][1], :ltv_max => 0.75
emit 'FIXED-20', table[4][1], :ltv_max => 0.75
emit 'FIXED-30', table[5][1], :ltv_max => 0.75
class Table
def initialize(selector, document)
@table = document.search(selector).search("tr").map do |tr|
tr.search("th, td").map do |td|
td.inner_text.strip.gsub(/$/, '$')
end.first
end
# confirms it's a table
unless @table.is_a?(Array) && @table.first.is_a?(Array)
raise UnAdaptedError.new("table parsing failed")
capture do |emit|
emit.call 'FIXED-10', table[2][1], :ltv_max => 0.75
emit.call 'FIXED-15', table[3][1], :ltv_max => 0.75
emit.call 'FIXED-20', table[4][1], :ltv_max => 0.75
emit.call 'FIXED-30', table[5][1], :ltv_max => 0.75
table = tables[3]
emit.call 'ARM-1', table[2][1], :ltv_max => 0.75
emit.call 'ARM-3', table[3][1], :ltv_max => 0.75
//@jpalardy knows closures
var filterFormFields = (function() {
var mapping = { "0" : "c_refinance",
"1" : "c_home_equity"
"2" : "c_dept_consolidation",
"3" : "c_new_home_purchase" };
return function() {
jQuery("#searchbox > div").hide();
target = mapping[jQuery("#reason").val()];
Undefined symbols:
"_curl_easy_perform", referenced from:
postTwitter(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)in ccTLU0tl.o
"_curl_easy_setopt", referenced from:
postTwitter(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)in ccTLU0tl.o
postTwitter(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)in ccTLU0tl.o
postTwitter(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)in ccTLU0tl.o
postTwitter(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)in ccTLU0tl.o
postTwitter(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)in ccTLU0tl.o
postTwitter(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)in ccTLU0tl.o
@brapse
brapse / gist:115897
Created May 22, 2009 03:07
debug with pp
###########################
#VIEW
##########################
<h1>Request password reset</h1>
<%= flash[:notice] %>
<%= flash[:error] %>
<%= error_messages_for :user %>
<p>Have you forgotten your password? Don't worry, simply enter your email address below and we will send you a link to enable you to reset your password.</p>
Datamapper is an ruby (MRI, YARV, JRuby) Object Relational Mapper (ORM) comparable to Sequel or ActiveRecord. Unlike it's comparables, datamapper is becoming increasingly data store agnostic. Not only can it be used to avoid writing sql, but is aiming to define a general language for object storage. This talk aims to present the recent developments in dm-core/next branch and what these changes have to offer developers working with multiple non relational data stores.