TODO: make gem for this
This was tested using Rails 3.2 and Rails 4.0 on Ruby 2.0.0.
-
Set the install directory for Bower components:
// .bowerrc
| // | |
| // Backbone.Rails.js | |
| // | |
| // Makes Backbone.js play nicely with the default Rails setup, i.e., | |
| // no need to set | |
| // ActiveRecord::Base.include_root_in_json = false | |
| // and build all of your models directly from `params` rather than | |
| // `params[:model]`. | |
| // | |
| // Load this file after backbone.js and before your application JS. |
| # Rails3 way to redirect non-www domain to www domain | |
| # Single domain redirect | |
| 'example.com'.tap do |host| | |
| constraints(:host => host) do | |
| root :to => redirect {|params, req| URI.escape(req.query_string.present? ? "#{req.protocol}www.#{host}?#{req.query_string}" : "#{req.protocol}www.#{host}") } | |
| match '/*path', :to => redirect {|params, req| URI.escape(req.query_string.present? ? "#{req.protocol}www.#{host}/#{params[:path]}?#{req.query_string}" : "#{req.protocol}www.#{host}/#{params[:path]}") } | |
| end | |
| end |
| require 'rubygems' | |
| require 'faraday' | |
| require 'socksify' | |
| require 'socksify/http' | |
| require 'awesome_print' | |
| # This is a SOCKS monkey patch for Faraday, with example use/unit test. | |
| # Notes: | |
| # * It is altered to work with SOCKS5 authentication. | |
| # * net_http_class must return a Faraday::Adapter::NetHttp instance. |