This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module FoosController | |
class Index < ControllerAction | |
def get | |
@foos = Foo.all | |
succeed_with(FooPresenter.new(@foos).to(format)) # if you want more control over presentation, hand off to the presenter | |
end | |
end # Index | |
class Create < ControllerAction | |
def post |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FoosController < ApplicationController | |
def index | |
### | |
end | |
def show | |
### | |
end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'active_support/core_ext/string/inflections' | |
class Router | |
attr_reader :env, :route | |
def initialize(routes, env) | |
@env = env | |
@routes = routes | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ChessApp | |
def self.routes | |
@routes ||= ActionDispatch::Routing::RouteSet.new.tap do |r| | |
r.draw do | |
resources :games, :only => [:index, :create, :show, :update] | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@routes ||= ActionDispatch::Routing::RouteSet.new.tap do |r| | |
r.draw do | |
resources :games, :only => [:index, :create, :show, :update] | |
end | |
end | |
@routes.recognize_path("/games", {:method => 'GET'}) # => {:action => "index", :controller => "games"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$git log --grep "help me" | |
(END) | |
$git log --grep "save me" | |
(END) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
flog app/controllers | head -10 rvm:ruby-2.0.0-p195 | |
6097.5: flog total | |
23.8: flog/method average | |
438.8: AController#overall | |
311.8: Ad::IQController#create | |
226.7: AController#level_meter | |
204.9: QController#topic_level_selector | |
168.2: M::ApiController#flip | |
140.2: TController#index |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ wc -l spec/**/*.rb | sort -r | head -10 | |
zsh: no matches found: spec/**/*.rb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ wc -l **/*.rb | sort -r | head -10 | |
7104 total | |
720 models/question.rb | |
468 controllers/god_controller.rb | |
407 controllers/analytics_controller.rb | |
382 controllers/admin/god_controller.rb | |
258 models/user.rb | |
252 controllers/mobile/api_controller.rb | |
167 controllers/admin/foo_controller.rb | |
140 models/quux.rb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'mechanize' | |
a = Mechanize.new | |
results = {} | |
last_id = 647 | |
(1..last_id).map do |id| | |
begin | |
page = a.get("http://cfp.euruko2013.org/users/#{id}/selections") | |
d = page. |