Skip to content

Instantly share code, notes, and snippets.

@ktkaushik
ktkaushik / remove_paranoia.rb
Created May 23, 2012 03:16
overriding 'remove' for Mongoid::Paranoia to delete its associate child models as well.
module Mongoid
module Paranoia
extend ActiveSupport::Concern
module ClassMethods
end
module InstanceMethods
# 'remove' method is soft-delete for Paranoia module which i read somewhere is extracted from
@ktkaushik
ktkaushik / StripeTutorialPage.html
Created June 4, 2012 11:32 — forked from boucher/StripeTutorialPage.html
Stripe Tutorial Payment Form
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Stripe Getting Started Form</title>
<script type="text/javascript" src="https://js.stripe.com/v1/"></script>
<!-- jQuery is used only for this example; it isn't required to use Stripe -->
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript">
// this identifies your website in the createToken call below
@ktkaushik
ktkaushik / rvmrc
Created August 17, 2012 02:33
my rvmrc file
#!/usr/bin/env bash
# This is an RVM Project .rvmrc file, used to automatically load the ruby
# development environment upon cd'ing into the directory
# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
environment_id="ruby-1.9.2-p290@imetrics"
#
# Uncomment following line if you want options to be set only for given project.
@ktkaushik
ktkaushik / nginx.conf
Created September 6, 2012 21:17
my nginx conf
user www-data;
worker_processes 1;
error_log /var/log/nginx.error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
@ktkaushik
ktkaushik / push_on_heroku.rb
Created September 7, 2012 07:23
steps for swapnil
# Copy paste line by line in your terminal. On the same window.
# Do not copy paste the sentences with '#' in teh beginning
heroku login
git checkout master
git merge dev
git push origin master
@ktkaushik
ktkaushik / profile_page.html.erb
Created September 20, 2012 06:52
change div class from _ to - to dry html in rails
<div class="profile-<%= act.class.name.underscore.downcase.to_s.split('_').join('-') %>"></div>
@ktkaushik
ktkaushik / deploy.rb
Created October 13, 2012 15:42 — forked from mikhailov/deploy.rb
capistrano prettify
# standard capistrano config goes here....
# Put the maintenance screen if DB migrations take in place only
before "deploy", "deploy:delayed_job:stop"
before "deploy:migrations", "deploy:delayed_job:stop"
after "deploy:update_code", "deploy:symlink_shared", "deploy:assets_compress"
before "deploy:migrate", "deploy:web:disable", "deploy:db:backup"
after "deploy", "newrelic:notice_deployment", "deploy:cleanup", "deploy:delayed_job:restart"
@ktkaushik
ktkaushik / gist:4057843
Created November 12, 2012 06:40
PostgreSQL build notes from homebrew
If builds of PostgreSQL 9 are failing and you have version 8.x installed,
you may need to remove the previous version first. See:
https://github.com/mxcl/homebrew/issues/issue/2510
To build plpython against a specific Python, set PYTHON prior to brewing:
PYTHON=/usr/local/bin/python brew install postgresql
See:
http://www.postgresql.org/docs/9.1/static/install-procedure.html
# Create/Upgrade a Database
@ktkaushik
ktkaushik / sysctl.conf
Created November 12, 2012 06:47
/etc/sysctl.conf
kern.sysv.shmmax=33554432
kern.sysv.shmmin=1
kern.sysv.shmmni=256
kern.sysv.shmseg=64
kern.sysv.shmall=8192
@ktkaushik
ktkaushik / postgresql
Created November 14, 2012 10:47
PostgreSQL server start, stop and status
# Start
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
# Stop
pg_ctl -D /usr/local/var/postgres stop -s -m fast
# Status
pg_ctl -D /usr/local/var/postgres status