- If you go red, undo
- Only change one line at a time
- Find two strings that are the most alike
- Find the smallest difference
- Make the smallest change that make the tests pass
# in AttachmentsHelper: | |
def safe_attachment_path(attachment, size=nil) | |
retrieve_attachment_path(attachment.id, attachment.original_name, :size => size) | |
end | |
# and then have a route | |
match '/files/:id/:filename' => 'attachments#retrieve', :as => :retrieve_attachment | |
# and a controller action | |
def retrieve |
# This controller returns static pages | |
class PagesController < ApplicationController | |
end | |
# routes.rb | |
get "help", to: "pages#help" | |
get "about", to: "pages#about" | |
get "privacy", to: "pages#privacy" | |
# ApplicationController: |
# migration | |
t.integer :sequence | |
# controller action | |
# and the way we've done the method, it's probably logical to put the action in test_scenarios_controller | |
def sequence | |
TestScenario.sequence=(params[:sequence]) | |
render :json => { :status => :ok } | |
end |
require "json" | |
require "net/http" | |
class DataRetriever | |
include ActiveModel::Model | |
attr_reader :search_param, :search_by_id | |
def get_data(search_param, options = {}) | |
@search_by_id = options.fetch([:search_by_id], false) | |
@search_info = search_info |
# POODR page 28 | |
Wheel = Struct.new(:rim, :tire) | |
def wheelify(data) | |
data.collect {|cell| Wheel.new(cell[0], cell[1])} | |
end | |
# POODR Page 32 | |
class Gear | |
attr_reader :chainring, :cog, :wheel | |
def initialize(chainring, cog, rim, tire) |
In one sentence: we are looking for simplicity, readability, and good practices
NYC Recommendations
Smorgasburg: foodie market in various locations between April to November. Go hungry!
#Vim Cheat Sheet
gqip
- Reformats paragraph to textwidthgq
- Reformats selection:Tab /=
- Equally spaces based on the = symbol (requires Tabular vim plugin):setf language
- Changes current language:set language=language
- Changes current language<C-a>
- Increments the number under the cursor<C-x>
- Decrements the number under the cursor~
- Toggles case and moves to next character in normal mode