Skip to content

Instantly share code, notes, and snippets.

View tispratik's full-sized avatar

Pratik Khadloya tispratik

View GitHub Profile
## Canonical redirect for Apache
# BEGIN Canonical Redirect
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.domain\.com$ [NC] ## will match any domain that's not our main domain
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]
</IfModule>
# END Canonical Redirect
class ApplicationController < ActionController::Base
protect_from_forgery
protected
def handle_unverified_request
super
raise ActionController::InvalidAuthenticityToken
end
@tispratik
tispratik / Berksfile
Created December 8, 2013 22:15 — forked from dwynne/Berksfile
cookbook 'nginx-app', '~> 0.1.0', path: 'cookbooks/nginx-app'
#!/usr/bin/env bash
# Pre-requisites
apt-get -y update
sudo apt-get --no-install-recommends -y install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev libgdbm-dev ncurses-dev automake libtool bison subversion pkg-config libffi-dev
# Download and compile Ruby 2.0.0-p247
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p247.tar.gz
tar -xvzf ruby-2.0.0-p247.tar.gz
#!/bin/bash
mkdir /tmp/curl-ca-bundle
cd /tmp/curl-ca-bundle
wget http://curl.haxx.se/download/curl-7.22.0.tar.bz2
tar xzf curl-7.22.0.tar.bz2
cd curl-7.22.0/lib/
./mk-ca-bundle.pl
if [ ! -d /usr/share/curl/ ]; then
sudo mkdir -p /usr/share/curl/
else
#!/bin/sh
# A pre-commit hook for git to lint JavaScript files with jshint
# @see https://github.com/jshint/jshint/
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
@tispratik
tispratik / .jshintrc
Created January 31, 2013 20:54 — forked from haschek/.jshintrc
{
// --------------------------------------------------------------------
// JSHint Configuration, Strict Edition
// --------------------------------------------------------------------
//
// This is a options template for [JSHint][1], using [JSHint example][2]
// and [Ory Band's example][3] as basis and setting config values to
// be most strict:
//
// * set all enforcing options to true
@tispratik
tispratik / Gemfile.lock
Created June 13, 2012 21:17
Gemfile.lock
GIT
remote: git://github.com/marktorrance/awesome_nested_set.git
revision: 79e7f4839f9c47ea4181067a459286964858f74f
specs:
awesome_nested_set (2.1.2)
activerecord (>= 3.0.0)
GIT
remote: git://github.com/mbleigh/ruby-openid.git
revision: 4b6fdd152edbc9d1f617056879eb03bd82b78eb4
@tispratik
tispratik / Gemfile
Created June 13, 2012 21:16
Gemfile
source 'http://rubygems.org'
gem 'rails', '~> 3.1.0'
gem 'mongrel', '>=1.2.0.pre2', :group => :development
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'mysql2'
# This patch is required:
# For: google authentication.
# When: Running rails on a port other than 80 where a proxy server proxies to rails.
# Cause: 1. Rack is not able to figure out that it should not set the realm url port to the rails custom port in case the full_host is mentioned using
# OmniAuth.config.full_host
# 2. OpenID tries to validate the incoming callback url with the custom port that rails is running on and throws the error "return_to #{meth.to_s} does not match".
env = Rails.env
if env != "development"