Skip to content

Instantly share code, notes, and snippets.

View ParthivPatel-BTC's full-sized avatar

ParthivPatel-BTC ParthivPatel-BTC

View GitHub Profile
1.DRY - Dont' Repeat Yourself
2.Two spaces, no tabs
3.Boolean Tests: don't use "and" and "or", always use "&&" and "||"
Comments
--------
1.Remove old commented code
2."How to" comments - If you add/change any method/variables etc.., always add detailed description in just above line. So, anybody can understand that code.
Camels for Classes, Snakes Everywhere Else
#! /bin/sh
set_path="cd APP_FULL_PATH"
case "$1" in
start)
echo -n "Starting delayed_job: "
su - imdeploy -c "$set_path; RAILS_ENV=production script/delayed_job start" >> /var/log/delayed_job.log 2>&1
echo "done." ;;
stop) echo -n "Stopping delayed_job: "
su - imdeploy -c "$set_path; RAILS_ENV=production script/delayed_job stop" >> /var/log/delayed_job.log 2>&1
echo "done." ;;
check process delayed_job
with pidfile /home/USER_NAM/APP_NAME/shared/pids/delayed_job.pid
start program = “/usr/bin/env RAILS_ENV=production /home/USER_NAM/APP_NAME/current/script/delayed_job start”
stop program = “/usr/bin/env RAILS_ENV=production /home/USER_NAM/APP_NAME/current/script/delayed_job stop”
@ParthivPatel-BTC
ParthivPatel-BTC / test.rb
Created September 12, 2015 11:18
Delete all database records
ActiveRecord::Base.connection.tables.map do |model|
unless ['schema_migrations', 'cic_user_profiles'].include?(model)
klass = model.capitalize.singularize.camelize.constantize
puts "Deleting #{klass}"
klass.delete_all
end
end