Legend:
- ✏️ method changes
this. - 🔒 method does not change
this.
Array<T>.prototype.*:
concat(...items: Array): T[]🔒 ES3
| require "bundler/capistrano" | |
| server "96.126.100.112", :web, :app, :db, primary: true | |
| set :application, "capteste" | |
| set :user, "deployer" | |
| set :deploy_to, "/home/#{user}/apps/#{application}" | |
| set :deploy_via, :remote_cache | |
| set :use_sudo, false | |
| set :port, "3030" |
| set :application, "sprai" | |
| # RVM integration | |
| # http://beginrescueend.com/integration/capistrano/ | |
| $:.unshift(File.expand_path('./lib', ENV['rvm_path'])) | |
| require "rvm/capistrano" | |
| set :rvm_ruby_string, "1.9.2-p290" | |
| set :rvm_type, :user | |
| # Bundler integration (bundle install) |
| class Array | |
| def self.toy(n=10, &block) | |
| block_given? ? Array.new(n,&block) : Array.new(n) {|i| i+1} | |
| end | |
| end | |
| class Hash | |
| def self.toy(n=10) | |
| Hash[Array.toy(n).zip(Array.toy(n){|c| (96+(c+1)).chr})] | |
| end |
| # app/models/my_model.rb | |
| module MyApp | |
| module Model | |
| def self.included(base) | |
| base.send :include, Mongoid::Document | |
| base.send :include, Mongoid::Timestamps | |
| base.send :include, ActiveAdmin::Mongoid::Patches | |
| end | |
| end |
| Rails3 - CheatSheet - CommandLine | |
| rails new ApplicationName – Create a new application | |
| rails _3.0.9_ new ApplicationName – Create a new application with a specific version of rails | |
| rails generate/g model ModelName – Creates a model with the specified model_name | |
| rails generate/g controller ControllerName – Creates a controller with the specified controller_name | |
| rails generate/g migration MigrationName – Creates a migration with the specified migration_name | |
| rails generate/g scaffold ModelName ControllerName – A shortcut for creating your controller, model and view files etc. | |
| rails destroy controller ControllerName – Destroys the created controller and its related file. | |
| rails destroy model - Destroys the created model and its related file. |
| # RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com | |
| # defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below) | |
| module Player | |
| describe MovieList, "with optional description" do | |
| it "is pending example, so that you can write ones quickly" | |
| it "is already working example that we want to suspend from failing temporarily" do | |
| pending("working on another feature that temporarily breaks this one") |
| # RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com | |
| # defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below) | |
| module Player | |
| describe MovieList, "with optional description" do | |
| it "is pending example, so that you can write ones quickly" | |
| it "is already working example that we want to suspend from failing temporarily" do | |
| pending("working on another feature that temporarily breaks this one") |
| <script> | |
| // test for localStorage support | |
| if(('localStorage' in window) && window['localStorage'] !== null){ | |
| var f = document.getElementById('mainform'); | |
| // test with Ruby if the form was sent (the submit button has the name "sent") | |
| <% if params[:sent] %> | |
| // get the HTML of the form and cache it in the property "state" | |
| localStorage.setItem('state',f.innerHTML); | |
| // if the form hasn't been sent... | |
| <% else %> |