Ouça a playlist no Rdio.
Música que mostrou a cara da banda pro mundo. Refrão marcante, meio chiclete. Encaixa em qualquer trilha sonora de comercial modernoso.
Ouça a playlist no Rdio.
Música que mostrou a cara da banda pro mundo. Refrão marcante, meio chiclete. Encaixa em qualquer trilha sonora de comercial modernoso.
ExUnit.start | |
defmodule SearchTokenizerTest do | |
use ExUnit.Case | |
test "tokenizes an empty text" do | |
text = "" | |
assert Search.tokenize(text) == [] | |
end |
gpfb() { | |
git add . && git commit --amend -C HEAD && git push -f | |
} | |
# Public: Go to a git branch from a given partial name. | |
# | |
# $1 - The branch partial name. | |
# | |
# Examples | |
# |
{ | |
"bold_folder_labels": true, | |
"color_scheme": "Packages/User/Xcode_default.tmTheme", | |
"ensure_newline_at_eof_on_save": true, | |
"font_face": "Menlo", | |
"font_size": 12, | |
"highlight_line": true, | |
"highlight_modified_tabs": true, | |
"ignored_packages": | |
[ |
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |
RUBY PROFILING | |
ruby-prof | |
http://www.dan-manges.com/blog/rails-performance-tuning-workflow | |
http://snippets.aktagon.com/snippets/255-how-to-profile-your-rails-and-ruby-applications-with-ruby-prof | |
http://blog.endpoint.com/2012/05/profile-ruby-with-ruby-prof-and.html | |
https://www.coffeepowered.net/2013/08/02/ruby-prof-for-rails/ | |
https://github.com/ruby-prof/ruby-prof/blob/master/examples/graph.txt | |
https://github.com/tmm1/stackprof | |
http://www.confreaks.com/videos/5096-RubyConf2014-real-world-ruby-performance-at-scale |
# encoding: utf-8 | |
module ChainOfResponsibility | |
attr_writer :successor | |
def can_handle_request?(request); end | |
def do_handle(request); end | |
def handle_request(request) | |
if can_handle_request?(request) |
class User < ActiveRecord::Base | |
def admin? | |
role? :admin | |
end | |
def role?(role) | |
roles.include? role | |
end |
module BookScopes | |
def self.extended(base) | |
base.instance_exec &scope_definitions | |
end | |
def self.included(base) | |
base.class_exec &scope_definitions | |
end |
class BooksController < ApplicationController | |
def index | |
# params = { filters: { genre: "Westerns", sold_out: 1 } } | |
@books = Book.filtered(params[:filters]) | |
end | |
end |