Skip to content

Instantly share code, notes, and snippets.

View benhamill's full-sized avatar
💖

Ben Hamill benhamill

💖
View GitHub Profile
module Example
def to_yaml
already_tested
end
end
class ExampleHolder
include Example
end
$ rake db:migrate
... wait a bit ...
^Crake aborted!
/home/ben/.../Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)
$ git diff
diff --git a/Gemfile.lock b/Gemfile.lock
index bdcbc43..d5dba5e 100644
--- a/Gemfile.lock
[merge]
tool = kdiff3
[diff]
tool = kdiff3
[11:59 PM] ben@eris:~/dev/project [master]$ gem install gherkin --version=2.1.5 -- -Wno-error=address
Building native extensions. This could take a while...
ERROR: Error installing gherkin:
ERROR: Failed to build gem native extension.
/home/ben/.rvm/rubies/ree-1.8.7-2011.03/bin/ruby extconf.rb -Wno-error=address
checking for main() in -lc... yes
creating Makefile
make
# gem --version
1.3.7
# rvm rubygems 1.6.2
Removing old Rubygems files...
Installing rubygems dedicated to ruby-1.9.2-p180...
Installing rubygems for /usr/local//rvm/rubies/ruby-1.9.2-p180/bin/ruby
Installation of rubygems completed successfully.
# gem --version
/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/config_file.rb:28:in `<top (required)>': uninitialized constant Gem::ConfigFile (NameError)
from /usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
@benhamill
benhamill / example_a.rb
Created May 17, 2011 18:48
Two ways that take a case statement out of your controller.
class UserConroller
def index
@users = User.sort_by(params[:sort_by])
end
end
class User
def sort_by(sort_by)
case sort_by
:created_at order(:created_at)
@benhamill
benhamill / Gemfile
Created May 24, 2011 15:46
Trouble installing rails from git
source 'http://rubygems.org'
gem 'rails', :git => 'git://github.com/rails/rails.git', :tag => 'v3.1.0.rc1'
gem 'pg'
gem 'devise'
gem 'slim'
gem 'sass'
gem 'coffee-script'
Order found merchants in SQL statement.
Situation:
- a user is trying to create an EMS for a merchant
- that merchant isn't a system merchant
- that merchant isn't a sync_user merchant for them
- there's an existing sync_user Merchant for someone else that matches based on
just the fqdn
- there's an existing Merchant that matches based on the full email
address
$ gem install nokogiri --version=1.4.4 -- --with-xml2-include=/usr/include/libxml2/
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/home/ben/.rvm/rubies/ree-1.8.7-2011.03/bin/ruby extconf.rb --with-xml2-include=/usr/include/libxml2/
checking for libxml/parser.h... no
-----
libxml2 is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
-----
Section "InputClass"
Identifier "touchpad catchall"
Driver "synaptics"
MatchIsTouchpad "on"
MatchDevicePath "/dev/input/event*"
Option "TapButton1" "1"
Option "TapButton2" "2"
Option "TapButton3" "3"
# Reverse scroll-wheel direction