gem install rails --pre
rails new my_app -T
| (function($) { | |
| function parseImagesFromCSS(doc) { | |
| var i, j, | |
| rule, | |
| image, | |
| pattern = /url\((.*)\)/, | |
| properties = ['background-image', '-webkit-border-image'], | |
| images = {}; | |
| if (doc.styleSheets) { |
| # Nginx+Unicorn best-practices congifuration guide. Now with SPDY! | |
| # We use latest stable nginx with fresh **openssl**, **zlib** and **pcre** dependencies. | |
| # Some extra handy modules to use: --with-http_stub_status_module --with-http_gzip_static_module | |
| # | |
| # Deployment structure | |
| # | |
| # SERVER: | |
| # /etc/init.d/nginx (1. nginx) | |
| # /home/app/public_html/app_production/current (Capistrano directory) | |
| # |
| set t_Co=256 | |
| set background=dark | |
| if !has('gui_running') | |
| let g:solarized_termcolors=&t_Co | |
| let g:solarized_termtrans=1 | |
| endif | |
| colorscheme solarized |
| require "faraday" | |
| require 'typhoeus' | |
| conn = Faraday.new(:url => 'http://httpstat.us') do |builder| | |
| builder.request :url_encoded | |
| builder.response :logger | |
| builder.adapter :typhoeus | |
| end | |
| conn.in_parallel do |
| if [ -f "$rvm_path/scripts/rvm" ]; then | |
| source "$rvm_path/scripts/rvm" | |
| if [ -f ".rvmrc" ]; then | |
| source ".rvmrc" | |
| fi | |
| if [ -f ".ruby-version" ]; then | |
| rvm use `cat .ruby-version` | |
| fi |
| require 'rubygems' | |
| require 'bundler' | |
| Bundler.require | |
| require './application' | |
| namespace :assets do | |
| desc 'compile assets' | |
| task :compile => [:compile_js, :compile_css] do | |
| end |
| class ApplicationController < ActionController::Base | |
| # ... | |
| unless Rails.application.config.consider_all_requests_local | |
| rescue_from Exception, with: lambda { |exception| render_error 500, exception } | |
| rescue_from ActionController::RoutingError, ActionController::UnknownController, ::AbstractController::ActionNotFound, ActiveRecord::RecordNotFound, with: lambda { |exception| render_error 404, exception } | |
| end | |
| private | |
| def render_error(status, exception) |
| # default vim on osx doesn't have python, ruby support or clipboard support. These configure options add all that | |
| # I also ran into problems using rvm ruby, had to include those libs in the LDFLAGS for vim | |
| # Steps: | |
| $ rvm install 1.9.1 | |
| $ rvm use 1.9.1 # vim doesn't support anything higher | |
| $ curl ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2 | tar xj | |
| $ cd vim73 | |
| $ ./configure --with-features=huge --enable-perlinterp=yes --enable-rubyinterp=yes --enable-pythoninterp=yes --enable-multibyte |
Testing OAuth Apis in rails 3.x apps