This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/initializers/sql_logger.rb | |
connection = ActiveRecord::Base.connection | |
class << connection | |
alias :original_exec :execute | |
def execute(sql, *name) | |
# try to log sql command but ignore any errors that occur in this block | |
# we log before executing, in case the execution raises an error | |
begin | |
rails_env = ENV['RAILS_ENV'] || 'development' | |
file = File.open(Rails.root.to_s + "/log/sql_#{rails_env}.log",'a'){|f| f.puts Time.now.to_s+": "+sql} if (%w(staging development).include? rails_env) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
God.watch do |w| | |
w.name = "mysqld" | |
w.interval = 30.seconds # default | |
w.start = "service mysql start" | |
w.stop = "service mysql stop" | |
w.restart = "service mysql restart" | |
w.start_grace = 20.seconds | |
w.restart_grace = 20.seconds | |
w.pid_file = "/var/lib/mysql/hostname.pid" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sessions: | |
signed_in: 'Signed in successfully.' | |
signed_in_first_time: "MY CUSTOM WELCOME GREETING. DO NOT FORGET TO READ OUR GUIDELINE!" | |
signed_out: 'Signed out successfully.' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: nginx | |
# Required-Start: $local_fs $remote_fs $network $syslog | |
# Required-Stop: $local_fs $remote_fs $network $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the nginx web server | |
# Description: starts nginx using start-stop-daemon |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: redis-server | |
# Required-Start: $syslog | |
# Required-Stop: $syslog | |
# Should-Start: $local_fs | |
# Should-Stop: $local_fs | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: redis-server - Persistent key-value db |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Put this content to ~/.irbrc file (no extension) | |
require "rubygems" | |
begin | |
require "ap" | |
rescue LoadError => err | |
puts "Cannot find awesome_print gem. Please run 'gem install awesome_print' to install it." | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# dump SQL into console | |
require 'logger' | |
if ENV.include?('RAILS_ENV') && !Object.const_defined?('RAILS_DEFAULT_LOGGER') # rails 2 | |
Object.const_set('RAILS_DEFAULT_LOGGER', Logger.new(STDOUT)) | |
else # rails 3 | |
ActiveRecord::Base.logger = Logger.new(STDOUT) if defined? Rails::Console | |
end | |
# enable result formatting - install gem 'hirb' | |
require 'hirb' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~/.irbrc | |
# Requires the following gems: wirble, hirb | |
# | |
# Hirb: http://tagaholic.me/hirb/doc/index.html | |
# Wirble: http://pablotron.org/software/wirble/ | |
require 'irb/completion' | |
require 'irb/ext/save-history' | |
IRB.conf[:SAVE_HISTORY] = 100 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# see http://forrst.com/posts/Setting_up_SASS_on_Heroku-4dZ | |
# You can put this in config/initializers/sass.rb | |
# Setup directory in tmp/ to dump the generated css into | |
require "fileutils" | |
FileUtils.mkdir_p(Rails.root.join("tmp", "stylesheets", "generated")) | |
# Tell SASS to use the .sass files in public/stylesheets/sass and | |
# output the css to tmp/stylesheets/generated |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature: Notify admin when new company added | |
In order to manage registration | |
As an admin | |
I want to be notified by email about new company added | |
Scenario: Notify admin about new company | |
Given they have no companies | |
When they create company titled MailChimp | |
Then I should receive an email with subject "Please moderate company ExampleInc" | |
When I open the email with subject "Please moderate company ExampleInc" |