Skip to content

Instantly share code, notes, and snippets.

View daneharrigan's full-sized avatar

Dane Harrigan daneharrigan

View GitHub Profile
class Foo
def foo
puts "foo method"
end
end
module Bar
class Foo
def bar
puts "bar method"
source :rubygems
ruby "1.9.3"
gem "rails"
gem "heroku-api"
env :FOO
env :BAR
env :BAZ
class Foo
def bar
"bar"
end
module Baz
def bar
"baz"
super
@daneharrigan
daneharrigan / image_form.html.erb
Created March 22, 2012 00:16
rails form helpers
<%= form_for [@product, @image] do |f| %>
<%= f.file_field :file %>
<% end %>
@daneharrigan
daneharrigan / go.bash
Created February 16, 2012 01:30
add a go command to your shell
go()
{
local file_name=${1%.*}
if [ -n "$1" ]; then
__gocompile $file_name
__gorun $@
__gocleanup $file_name
else
echo "The file '$1' does not exist."
@daneharrigan
daneharrigan / configcompass.rb
Created January 17, 2012 21:42
config/compass.rb
project_type = :rails
output_style = :expanded
@daneharrigan
daneharrigan / fakeweb_factory.rb
Created January 5, 2012 00:34
FakeWeb gone factory?
# Step 1: patch fakeweb
module FakeWeb
@factory = {}
def self.factory(key)
return set_factory!(key) unless block_given?
@key = key
@factory[@key] ||= {}
eva:tae_jeong dharrigan$ bundle exec rake production db:bootstrap --trace
(in /Users/dharrigan/Projects/Personal/tae_jeong)
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /Users/dharrigan/.rvm/gems/ruby-1.8.7-head/gems/rails-2.3.14/lib/rails/gem_dependency.rb:21.
** Invoke production (first_time)
** Execute production
** Invoke environment (first_time)
** Execute environment
rake aborted!
uninitialized constant SheetsExtension::MenuRenderer
@daneharrigan
daneharrigan / gist:1506820
Created December 21, 2011 17:14
Failing spec in MRI
# fails:Proc#eql? returns true if the bodies of self and other are identical but represented by different objects
# (https://github.com/rubinius/rubinius/blob/master/spec/tags/19/ruby/core/proc/eql_tags.txt#L1)
eva:~ dharrigan$ ruby -v
ruby 1.9.3p6 (2011-12-20 revision 34080) [x86_64-darwin11.2.0]
eva:~ dharrigan$ irb
1.9.3p6 :001 > foo = proc { :foo }
=> #<Proc:0x007fb47122eea8@(irb):1>
1.9.3p6 :002 > foo2 = lambda { :foo }
=> #<Proc:0x007fb471232648@(irb):2 (lambda)>
@daneharrigan
daneharrigan / foo
Created December 13, 2011 00:16
sample thor task
#!/usr/bin/env ruby
require "thor"
class Foo < Thor
desc :foo, "This is the foo description"
def speak
puts "foo!!!"
end