brew install git bash-completion
Configure things:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
#Deploy and rollback on Heroku in staging and production | |
task :deploy_staging => ['deploy:set_staging_app', 'deploy:push', 'deploy:restart', 'deploy:tag'] | |
task :deploy_production => ['deploy:set_production_app', 'deploy:push', 'deploy:restart', 'deploy:tag'] | |
namespace :deploy do | |
PRODUCTION_APP = 'YOUR_PRODUCTION_APP_NAME_ON_HEROKU' | |
STAGING_APP = 'YOUR_STAGING_APP_NAME_ON_HEROKU' | |
task :staging_migrations => [:set_staging_app, :push, :off, :migrate, :restart, :on, :tag] | |
task :staging_rollback => [:set_staging_app, :off, :push_previous, :restart, :on] |
module ApiPageHelper | |
PAGINATE_OPTIONS = { | |
:default_page_size => 10 | |
} | |
PAGINATE_PARAMS = [ "page", "offset", "size" ] | |
def paginate(coll, options = {}) | |
options = PAGINATE_OPTIONS.merge(options) | |
if params[:page] | |
page = params[:page].to_i | |
size = (params[:size] || options[:default_page_size]).to_i |
# ** ERROR 1 ** | |
# FATAL: lock file "postmaster.pid" already exists | |
# HINT: Is another postmaster (PID 4646) running in data directory "/usr/local/var/postgres"? | |
# | |
# ** ERROR 2 ** | |
# Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"? | |
# | |
# To fix one of this errors: | |
cat /usr/local/var/postgres/postmaster.pid # pid is the number on first line |
#!/usr/bin/env ruby | |
# This is a basic deploy script for Heroku apps. | |
# It provides a structure you can use to expand on | |
# and add your own prereqs and deploy tasks. | |
# | |
# It basically ensures that: | |
# 1. There are no uncommited files | |
# 2. You can ssh to github | |
# 3. You can connect to heroku |
brew install git bash-completion
Configure things:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
package main | |
import ( | |
"database/sql" | |
"errors" | |
"fmt" | |
_ "github.com/bmizerany/pq" | |
"os" | |
"regexp" | |
"strings" |
$ redis-cli | |
> config set stop-writes-on-bgsave-error no |