Skip to content

Instantly share code, notes, and snippets.

/home/cag/cag/current/public/dispatch.cgi:10ndor/rails/railties/lib/dispatcher.rb:41:in `dispatch'0:in `process'4:in `sass_old_process'gement_support'
wtf
what's wrong?
@mikehale
mikehale / deploy.rb
Created July 22, 2008 19:55
capistrano recipe for working with slicehost dns api
load 'config/dns'
set :ip, '127.0.0.1'
set :domains, %w(example.net. example.com. example.org.)
def children(options = {})
options.merge!({ :order => 'updated_at desc' })
options # => {:limit=>3, :order=>"updated_at desc"}
found = articles.find(:all, options)
options # => {:conditions=>"`articles`.section_id = 2", :readonly=>nil, :select=>nil, :group=>nil, :offset=>nil, :limit=>3, :include=>:_route, :joins=>nil, :order=>"updated_at desc, created_at desc"}
found += pages.find(:all, options)
found.sort! { |x, y| y.updated_at <=> x.updated_at }
options[:limit] ? found[0, options[:limit]] : found
end
module ApplicationHelper
def e_tag(model)
eval("link_to image_tag(\'pencil.png\'), edit_#{model.class.name.underscore}_path(model)")
end
def d_tag(model)
eval("link_to image_tag(\'delete.png\'), model, :confirm => \'Are you sure?\', :method => :delete")
end
@quirkey
quirkey / gist:1247
Created July 22, 2008 20:02 — forked from mrb/gist:1245
module ApplicationHelper
def e_tag(model)
eval("link_to image_tag(\'pencil.png\'), edit_#{model.class.name.underscore}_path(model)")
end
def d_tag(model)
eval("link_to image_tag(\'delete.png\'), model, :confirm => \'Are you sure?\', :method => :delete")
end
/* It's a test! */
# this is cool
puts "very freaking cool."
def logistic(x, mu = 9):
'Smoothing function (s curve).'
return 1 - 1 /( 1 + math_e ** ((x - 1/2) * mu))