Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am htanata on github.
  • I am htanata (https://keybase.io/htanata) on keybase.
  • I have a public key ASDb9k6bhM6TaIXxKIRpST-Ih1kPvnvIMQRnZE5O9Z_9Xwo

To claim this, I am signing this object:

@htanata
htanata / rails_accept_header.rb
Created March 12, 2014 20:26
Rails "Accept" header
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
GEMFILE
system 'bundle'
end
require 'bundler'
@htanata
htanata / rails.localhost
Created November 21, 2011 22:00
Ubuntu Apache SSL proxy for Rails in development mode
<VirtualHost rails.localhost:80>
ServerName rails.localhost
ProxyPass / http://rails.localhost:3000/ retry=0
ProxyPassReverse / http://rails.localhost:3000
ProxyPreserveHost on
XSendFile on
XSendFileAllowAbove on
<Proxy *>
Order deny,allow
Allow from all
# Chef recipe to install mod_xsendfile to Ubuntu i386.
MOD_XSENDFILE_SOURCE_DIR = '/home/railsapp/mod_xsendfile'
PACKAGE_FILE = 'libapache2-mod-xsendfile_0.9-ppa1_i386.deb'
MOD_XSENDFILE_SOURCE = "#{MOD_XSENDFILE_SOURCE_DIR}/#{PACKAGE_FILE}"
directory MOD_XSENDFILE_SOURCE_DIR do
recursive true
end
module NoLayoutWhenXhr
private
def render(*args)
args[0] ||= {}
args.first[:layout] = false if request.xhr? && args.first[:layout].nil?
super
end
end