Skip to content

Instantly share code, notes, and snippets.

@HatemMahmoud
HatemMahmoud / rspec-report.sh
Last active August 29, 2015 14:02
Rspec report
# List group and example names
rspec spec --format d
# Generate HTML report
rspec spec --format html -o "public/rspec-report.html"
@HatemMahmoud
HatemMahmoud / rails-page-title-01.rhtml.erb
Created March 22, 2010 17:03
A simple way to customize page titles in Rails views
<!-- in views/products/index.html.erb -->
<% @title = "Catalog" %>
<!-- in application.rhtml.erb -->
<title><%= @title.titleize + ' - My Great Store' %></title>
@HatemMahmoud
HatemMahmoud / rails-page-title-02.rb
Created March 22, 2010 17:05
A simple way to customize page title in Rails controllers
#in products_controller.rb
before_filter :set_title
def set_title
# default title for this controller
@title = 'Products'
end
def index
# different title for this action
@title = 'Catalog'
@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 % .
@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 / 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/

Management

  • Pivotal Tracker
  • Flowdock

Repo

  • Github

Testing

  • RSpec
  • FactroyGirl
@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
@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 / 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/