Skip to content

Instantly share code, notes, and snippets.

Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb install mysql
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... no
checking for mysql_query() in -lmysqlclient... no
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb install mysql
extconf.rb:1:in `require': no such file to load -- mkmf (LoadError)
from extconf.rb:1
1) Error:
test_the_truth(Admin::FilmControllerTest):
Mysql::Error: Access denied for user 'root'@'localhost' (using password: NO)
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
1) Error:
test_the_truth(Admin::FilmControllerTest):
Mysql::Error: Unknown database 'application_name_test'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
@asmega
asmega / sed
Created July 31, 2011 12:11
find and replace with sed for rails 3 upgrade on named_scopes
find . -name *.rb -type f -exec sed -i 's/named_scope/scope/g' {} \;
@asmega
asmega / sed
Created August 1, 2011 08:19
find and delete line with sed
find ./spec/ -name *_spec.rb -type f -exec sed -i "/require \"spec\"/d" {} \;
@asmega
asmega / squish
Created August 21, 2011 15:49
git squish
git checkout -b squashed_feature
git rebase -i master
pick fda59df commit 1
squash x536897 commit 2
squash c01a668 commit 3
@asmega
asmega / index
Created October 17, 2011 11:57
remove ubuntu service
update-rc.d -f SERVICE remove
@asmega
asmega / main.rb
Created October 23, 2011 13:08
rails mass assignment checker
Dir.glob("#{Rails.root}/app/models/*.rb").collect{|m| m.split("/").last.split(".").first.camelize.constantize }
models = ActiveRecord::Base.subclasses.collect(&:name).collect(&:constantize)
models.each{|m| puts m; print "Columns: #{m.column_names}"; puts ""; print "Protected: #{m.attr_protected.to_a}"; puts ""; print "Accessible: #{m.attr_accessible.to_a}"; puts "\n\n" }
# example output
#
#User
#Columns: ["id", "email", "encrypted_password", "salt", "confirmation_token", "remember_token", #"created_at", "updated_at", "company_id", "status"]
#Protected: ["id", "type", "status", "company_id"]
@asmega
asmega / .curlrc
Created October 27, 2011 12:38
default proxy for curl in .curlrc
proxy=http://username:password@host:port