Skip to content

Instantly share code, notes, and snippets.

@HatemMahmoud
HatemMahmoud / Ubuntu rbenv
Created September 7, 2011 12:56
Installing Ruby 1.9.2 with OpenSSL on Ubuntu 11.04 using ruby-build and rbenv
# for more info: https://gist.github.com/1120938
@HatemMahmoud
HatemMahmoud / test-rails-email
Last active December 23, 2015 14:39
Testing ActionMailer configuration using Rails console
$ rails c
class MyMailer < ActionMailer::Base
default :from => 'actionmailer.debugger@example.com'
def test_email
mail(:to => "hatem@example.com", :subject => 'Testing from Rails console', :body => 'This is a test email')
end
end
MyMailer::test_email.deliver!
@HatemMahmoud
HatemMahmoud / rjb.sh
Created March 6, 2012 15:00
Rjb - Ruby Java Bridge
# Reference: http://www.ibm.com/developerworks/java/tutorials/j-rjb/j-rjb-pdf.pdf
$ java -version
$ apt-cache search jdk
$ apt-get install sun-java6-jdk
$ export JAVA_HOME="/usr/lib/jvm/java-6-sun-1.6.0.26/"
$ export PATH=$PATH:$JAVA_HOME/bin
$ gem install rjb
$ irb
irb(main):001:0> require 'rjb'
@HatemMahmoud
HatemMahmoud / rails-asmallorange.sh
Created July 8, 2012 06:52
Rails deployment to ASmallOrange
ssh myusername@mydomain.com
git clone git://github.com/myname/myapp.git
cd myapp/
@HatemMahmoud
HatemMahmoud / rbenv-gems-error.sh
Created July 3, 2012 16:10
Fixing command not found errors with rbenv
# Problem
$ rspec
-bash: rspec: command not found
# Solution
gem install rspec-core && rbenv rehash
@HatemMahmoud
HatemMahmoud / ruby-debug_ruby193.sh
Created March 31, 2012 13:13
ruby-debug error with Ruby 1.9.3
# Error: /Users/hatem/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/ruby-debug-base19-0.11.25/lib/ruby-debug-base.rb:1:in `require': dlopen(/Users/hatem/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.bundle, 9): Symbol not found: _ruby_current_thread (LoadError)
# First download linecache19-0.5.13.gem and ruby-debug-base19-0.11.26.gem from http://rubyforge.org/frs/?group_id=8883
# Then, install the new gems
gem install linecache19-0.5.13.gem
gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=/Users/hatem/.rbenv/versions/1.9.3-p0/include/ruby-1.9.1/ruby-1.9.3-p0/
# Then, update your app
bundle update ruby-debug-base19
# Reference: http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug

Management

  • Pivotal Tracker
  • Flowdock

Repo

  • Github

Testing

  • RSpec
  • FactroyGirl
@HatemMahmoud
HatemMahmoud / postgres_socket_path_on_ubuntu.sh
Created October 24, 2011 09:41
Postgres socket path on Ubuntu
sudo mkdir /var/run/postgresql
sudo ln -s /tmp/.s.PGSQL.5432 /var/run/postgresql/
@HatemMahmoud
HatemMahmoud / rmagick_on_ubuntu.sh
Created October 24, 2011 09:40
Installing rmagick on Ububtu 11.04
sudo apt-get install imagemagick
sudo apt-get install libdjvulibre-dev libjpeg-dev libtiff-dev libwmf-dev libmagickcore-dev libmagickwand-dev libmagick++-dev
gem install rmagick
@HatemMahmoud
HatemMahmoud / find_and_move_files.sh
Created October 22, 2011 05:09
Find and move all files
find . -type f -name "*" -print0 | xargs -0 -J% mv % .