Skip to content

Instantly share code, notes, and snippets.

View patrickberkeley's full-sized avatar

Patrick Berkeley patrickberkeley

View GitHub Profile
<% form_for(@event) do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :title %><br />
<%= f.text_field :title %>
</p>
<p>
<%= f.label :permalink %><br />
<%= f.text_field :permalink %>
</p>
rake production radiant:extensions:aggregation:update --trace
** Invoke production (first_time)
** Execute production
** Invoke environment (first_time)
** Execute environment
rake aborted!
Don't know how to build task 'radiant:extensions:aggregation:update'
/opt/ruby-enterprise-1.8.6-20081215/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1704:in `[]'
/opt/ruby-enterprise-1.8.6-20081215/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2026:in `invoke_task'
/opt/ruby-enterprise-1.8.6-20081215/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in `top_level'
@patrickberkeley
patrickberkeley / _form.html.erb
Created April 28, 2009 19:11
Multiple sortable images using Paperclip. Example using a Page model.
<%= f.error_messages %>
<p>
<%= f.label :name %><br />
<%= f.text_field :name %>
</p>
<p>
<%= f.label :permalink %><br />
<%= f.text_field :permalink %>
</p>
<p>
# Method borrowed from deprecated Rails Inflector class
def ordinalize(number)
if (11..13).include?(number.to_i % 100)
"#{number}th"
else
case number.to_i % 10
when 1; "#{number}st"
when 2; "#{number}nd"
when 3; "#{number}rd"
else "#{number}th"
# oil painting program
# painting process to be added later
# This Ruby program is a beginners attempt at using Ruby
# to make a alla prima oil painting program
# basic materials and tools to make an alla prima painting
class Painting
# Simplified version of calvin stephens (http://github.com/Calvin4) elevator program.
class Building
# Ask the user for the top floor of the building
def get_top_floor
puts "Please enter the top floor: "
@top_floor = gets.chomp!.to_i
end
@patrickberkeley
patrickberkeley / dna.rb
Created July 13, 2009 19:12
DNA search program
class Dna
# Prompt user for input.
def pick_one
puts "Enter DNA sequence. Must contain a, t, c, and g."
input = gets.chomp
process_input(input)
end
# Hash of dna sequences and values.
# If input exists in hash, return value.
@patrickberkeley
patrickberkeley / toggle.html
Created July 20, 2009 23:59
Simple jQuery show/hide toggle based on class and ID naming convention.
<div class="column">
<h3 class="grey"><span>Solutions</span></h3>
<ul>
<li><a id="section-link-overview" class="toggle" href="#overview">Overview</a></li>
<li><a id="section-link-1" class="toggle" href="#solution-1">Solution 1</a></li>
<li><a id="section-link-2" class="toggle" href="#solution-2">Solution 2</a></li>
<li><a id="section-link-3" class="toggle" href="#solution-3">Solution 3</a></li>
</ul>
</div>
~/code/peacechina$ rackup config.ru
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- peacechina (LoadError)
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from config.ru:2
from /usr/local/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/builder.rb:29:in `instance_eval'
from /usr/local/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/builder.rb:29:in `initialize'
from config.ru:1:in `new'
from config.ru:1
from /usr/local/bin/rackup:19:in `eval'
from /usr/local/lib/ruby/gems/1.8/gems/rack-1.0.0/bin/rackup:103
~/code/peacechina$ rackup config.ru -d
Exception `LoadError' at /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31 - no such file to load -- sinatra/base
Exception `LoadError' at /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31 - no such file to load -- Win32API
Exception `LoadError' at /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:38 - no such file to load -- Win32API
Exception `NoMethodError' at /usr/local/lib/ruby/gems/1.8/gems/sinatra-0.9.2/lib/sinatra/base.rb:830 - undefined method `extensions' for Object:Class
Exception `NoMethodError' at /usr/local/lib/ruby/gems/1.8/gems/sinatra-0.9.2/lib/sinatra/base.rb:830 - undefined method `extensions' for Object:Class
Exception `NoMethodError' at /usr/local/lib/ruby/gems/1.8/gems/sinatra-0.9.2/lib/sinatra/base.rb:830 - undefined method `extensions' for Object:Class
Exception `NoMethodError' at /usr/local/lib/ruby/gems/1.8/gems/sinatra-0.9.2/lib/sinatra/base.rb:830 - undefined method `extensions' for Object:Class
Exception