Skip to content

Instantly share code, notes, and snippets.

View ketanghumatkar's full-sized avatar

Ketan Ghumatkar ketanghumatkar

View GitHub Profile
@ketanghumatkar
ketanghumatkar / terminator.md
Last active December 25, 2015 13:49
Terminator is a cross-platform GPL terminal emulator with features Automatic logging, Find, Horizontal scroll, Multiple Tabs, etc.

Installation and Shortcuts

Installation

Step1 : Add Terminator Repository

sudo add-apt-repository ppa:gnome-terminator
@ketanghumatkar
ketanghumatkar / alias_method.md
Last active December 25, 2015 16:29
This gist gives the brief about alias_method and alias_method_chain.

alias_method

This method creates the alias(duplicate name) of the method

class Klass
  def a
    puts "alphabates"
  end
 
echo "This script requires superuser access to install packages."
echo "You will be prompted for your password by sudo."
# clear any previous sudo permission
sudo -k
# run inside sudo
sudo sh <<SCRIPT
# installing apache
echo ">>> Installing Apache2."

Ubuntu 12.04, Ruby, Rails, Nginx, Unicorn and git-deploy

In the seemlingly endless search for the actual correct and easy way to deploy a Rails app, we have tried several ways. We tried out using Apache2 and running a cluster of Thin servers. With the built in threading of Puma we decided to use it with Nginx.

Server Setup

  • Create new server
  • Login to new server
    • ssh root@IPaddress (you can also use the domain name if you have the DNS setup already)
    • accept the RSA key
@ketanghumatkar
ketanghumatkar / api_nodejs
Created November 26, 2013 13:08
This file describe the API Call with nodejs
var http = require('http');
data = {"foo":"bar"}
// create the JSON object
jsonObject = JSON.stringify(data);
// prepare the header
var postheaders = {
    'Content-Type' : 'application/json',
@ketanghumatkar
ketanghumatkar / _flash_messages.html.erb
Last active December 31, 2015 22:08 — forked from roberto/_flash_messages.html.erb
Rails flash message handler to include bootstrap classes
<% flash.each do |type, message| %>
<div class="alert <%= bootstrap_class_for(type) %> fade in">
<button class="close" data-dismiss="alert">×</button>
<%= message %>
</div>
<% end %>
# config/initializers/will_paginate.rb
module WillPaginate
module ActionView
def will_paginate(collection = nil, options = {})
options[:renderer] ||= BootstrapLinkRenderer
super.try :html_safe
end
class BootstrapLinkRenderer < LinkRenderer
@ketanghumatkar
ketanghumatkar / zsh.md
Created February 7, 2014 18:39 — forked from tsabat/zsh.md
sudo add-apt-repository ppa:pitti/postgresql
sudo apt-get update
sudo apt-get install postgresql-9.2 postgresql-server-dev-9.2 postgresql-contrib-9.2
sudo su -l postgres
psql -d template1 -p 5433
CREATE EXTENSION IF NOT EXISTS hstore;
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
service postgresql stop
/usr/lib/postgresql/9.2/bin/pg_upgrade -b /usr/lib/postgresql/9.1/bin -B /usr/lib/postgresql/9.2/bin -d /var/lib/postgresql/9.1/main/ -D /var/lib/postgresql/9.2/main/ -O "-c config_file=/etc/postgresql/9.2/main/postgresql.conf" -o "-c config_file=/etc/postgresql/9.1/main/postgresql.conf"