Skip to content

Instantly share code, notes, and snippets.

Avatar

Hatem Mahmoud HatemMahmoud

View GitHub Profile
View rspec-report.sh
# List group and example names
rspec spec --format d
# Generate HTML report
rspec spec --format html -o "public/rspec-report.html"
@HatemMahmoud
HatemMahmoud / test-rails-email
Last active Dec 23, 2015
Testing ActionMailer configuration using Rails console
View test-rails-email
$ 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 / rails-asmallorange.sh
Created Jul 8, 2012
Rails deployment to ASmallOrange
View rails-asmallorange.sh
ssh myusername@mydomain.com
git clone git://github.com/myname/myapp.git
cd myapp/
@HatemMahmoud
HatemMahmoud / rbenv-gems-error.sh
Created Jul 3, 2012
Fixing command not found errors with rbenv
View rbenv-gems-error.sh
# Problem
$ rspec
-bash: rspec: command not found
# Solution
gem install rspec-core && rbenv rehash
@HatemMahmoud
HatemMahmoud / ruby-debug_ruby193.sh
Created Mar 31, 2012
ruby-debug error with Ruby 1.9.3
View ruby-debug_ruby193.sh
# 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
@HatemMahmoud
HatemMahmoud / rjb.sh
Created Mar 6, 2012
Rjb - Ruby Java Bridge
View rjb.sh
# 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'
View my_rails_tools.markdown

Management

  • Pivotal Tracker
  • Flowdock

Repo

  • Github

Testing

  • RSpec
  • FactroyGirl
View postgres_socket_path_on_ubuntu.sh
sudo mkdir /var/run/postgresql
sudo ln -s /tmp/.s.PGSQL.5432 /var/run/postgresql/
@HatemMahmoud
HatemMahmoud / rmagick_on_ubuntu.sh
Created Oct 24, 2011
Installing rmagick on Ububtu 11.04
View rmagick_on_ubuntu.sh
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
View find_and_move_files.sh
find . -type f -name "*" -print0 | xargs -0 -J% mv % .
You can’t perform that action at this time.