Skip to content

Instantly share code, notes, and snippets.

View MaherSaif's full-sized avatar

Maher Saif MaherSaif

View GitHub Profile
# .railsrc for Rails 3, encoding: utf-8
# see http://rbjl.net/49-railsrc-rails-console-snippets
if !Rails.application then warn "Rails isn't loaded, yet... skipping .railsrc" else
# # #
def ripl?; defined?(Ripl) && Ripl.instance_variable_get(:@shell); end
# # #
# loggers
@MaherSaif
MaherSaif / .gitignore
Created May 22, 2011 16:31 — forked from ledermann/.gitignore
rake deploy and rake cache_assets for Heroku (storing JS minimized and gzipped on Amazon S3)
# Add this
public/javascripts/all.js
@MaherSaif
MaherSaif / rvm_install.sh
Created July 19, 2011 07:49 — forked from abarringer/rvm_install.sh
RVM Ubuntu Install
#!/bin/bash
#Based on http://railsapps.github.com/installing-rails-3-1.html
cd ~
sudo apt-get -y install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev curl git-core
bash < <(curl -sk https://rvm.beginrescueend.com/install/rvm)
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile
@MaherSaif
MaherSaif / gist:1095938
Created July 20, 2011 21:06 — forked from croaky/gist:1089598
Transfer data from production to staging on Heroku
heroku addons:add pgbackups --remote staging
heroku addons:add pgbackups --remote production
heroku pgbackups:capture --remote production
heroku pgbackups:restore DATABASE `heroku pgbackups:url --remote production` --remote staging
@MaherSaif
MaherSaif / gist:1105889
Created July 26, 2011 03:27
Ruby Style Guide
Original Source: https://github.com/chneukirchen/styleguide
= Christian Neukirchen's Ruby Style Guide
You may not like all rules presented here, but they work very well for
me and have helped producing high quality code. Everyone is free to
code however they want, write and follow their own style guides, but
when you contribute to my code, please follow these rules:
@MaherSaif
MaherSaif / installation.sh
Created July 30, 2011 22:45 — forked from mikhailov/installation.sh
Nginx+passenger application config: ssl redirection, http headers, passenger optimal settings. see details: http://mikhailov.posterous.com/nginx
$ cd /usr/src
$ wget http://nginx.org/download/nginx-0.8.52.tar.gz
$ tar xzvf ./nginx-0.8.52.tar.gz
$ rm ./nginx-0.8.52.tar.gz
$ gem install s3sync capistrano capistrano-ext passenger --no-ri --no-rdoc
$ passenger-install-nginx-module
# Automatically download and install Nginx? 2. No: I want to customize my Nginx installation
# Where is your Nginx source code located?: /usr/src/nginx-0.8.52
# Where do you want to install Nginx to?: /opt/nginx
@MaherSaif
MaherSaif / deploy.rb
Created August 17, 2011 16:24 — forked from stojg/deploy.rb
Silverstripe + Capistrano + Git recipie
# My ./config directory in silverstripe looks like this:
# ./503.php <- a 503 Maintainance page
# ./_ss_environment.php <- the production environment settings
# ./deploy.rb <- is the recipe below
#
# Application settings
set :application, "domain.com"
set :shared_children, %w(assets)
@MaherSaif
MaherSaif / deploy.rb
Created August 18, 2011 01:35 — forked from josegonzalez/deploy.rb
Capistrano Deploy Script for CakePHP applications using GIT (Update the $config hash))
$config = {
"application" => "DOMAIN.TLD",
"repository" => "git@GITHOST:USERNAME/REPOSITORYNAME.git",
"remoteusername" => "REMOTEUSERNAME",
"cake_folder" => "/PATH/TO/CAKE",
"cake_version" => "cakephp1.3",
"plugin_dir" => "plugins",
"servers" => {
"prod" => {
"server" => "APPLICATION.TLD",
@MaherSaif
MaherSaif / gist:1159311
Created August 20, 2011 16:39 — forked from hopsoft/gist:1122080
Rails Environment Based Behavior
# app/models/user.rb
class User < ActiveRecord::Base
end
# lib/user_logger.rb
module UserLogger
def self.included(mod)
mod.send :after_create, :log_creation
end
@MaherSaif
MaherSaif / osx_lion_rail_setup.md
Created August 22, 2011 14:23 — forked from jpantuso/osx_lion_rail_setup.md
Setup OS X 10.7 w/ homebrew, oh-my-zsh, rvm, rails, and MySQL