(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| Rails.application.routes.draw do | |
| get '/(:locale)/products/(:category)/(page/:page).:extension', | |
| :to => 'products#index', | |
| :as => :products, | |
| :constraints => { | |
| :locale => /[a-z]{2}/, | |
| :category => /.+?/, | |
| :page => /\d+/ | |
| }, |
| # 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") |
| class ApplicationController < ActionController::Base | |
| before_filter :page_params, :only => :index | |
| def page_key | |
| (self.class.to_s + "_page").to_sym | |
| end | |
| def page_params | |
| if params[:page] then | |
| session[page_key] = params[:page] |
| class Controller < ApplicationController | |
| @items = Sunspot.search(ModelName) do | |
| fulltext params[:q], :fields => ["description_#{I18n.locale}".to_sym, :author] | |
| end | |
| end |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| package main | |
| import ( | |
| "fmt" | |
| "log" | |
| "net/http" | |
| "runtime" | |
| "time" | |
| ) |