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 A | |
| attr_accessor :b | |
| delegate :c, :to => :b | |
| def do_things | |
| c.do_things | |
| 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
| source /usr/local/Cellar/git/1.7.11.3/etc/bash_completion.d/git-completion.bash | |
| function git_branch_name(){ | |
| git branch 2>/dev/null | grep -e '^*' | sed -E 's/^\* (.+)$/(\1) /' | |
| } | |
| function show_colored_git_branch_in_prompt(){ | |
| #PS1="\[\033[01;32m\]\u@\h:\[\033[01;34m\]\w\[\033[31m\]\$(git_branch_name)\[\033[m\]$ " | |
| #PS1='\[\033[32m\]\u \033[34m\][\w]\[\033[00m\]:\[\033[31m\]$(__git_ps1)\[\033[00m\]\$ ' | |
| PS1='\[\033[32m\]\u \033[01;34m\][\w]\[\033[31m\]$(__git_ps1)\[\033[00m\] \$ ' | |
| } |
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 'nokogiri' | |
| require 'htmlentities' | |
| require 'open-uri' | |
| doc = Nokogiri::HTML(open('http://www.ibge.gov.br/cidadesat/includes/ac.inc')) | |
| doc = doc.xpath('//p') | |
| doc.each do |c| | |
| @variables = c.text |
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 SomeController < ApplicationController | |
| before_filter :authenticate_with_public_token! | |
| private | |
| def authenticate_with_public_token! | |
| if params[:key] && user = User.find_by_public_token(params[:key]) | |
| sign_in("user", user) | |
| else | |
| authenticate_user! |
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
| context 'order' do | |
| let :first_payment do | |
| Payment.create | |
| end | |
| let :last_payment do | |
| Payment.create | |
| end | |
| let :payments do |
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
| 3 ovos | |
| 3 xícaras de polvilho (preferencia azedo, mas pode usar o doce também) | |
| 1 xícara de azeite | |
| 100g de queijo (qualquer um) | |
| sal a gosto. | |
| bata no liquidificador tudo, despeje em formas de empadinha coloque assar no forno, espere dourar, e pronto. |
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
| var Nohup; | |
| Nohup = {}; | |
| Nohup.Person = function Person(){ | |
| var init = function(name, age){ | |
| this.name = name; | |
| this.age = age; | |
| }; | |
| var Person = function(){ | |
| init.call(this, arguments[0], arguments[1]); |
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 SomethingController < ApplicationController | |
| respond_to :html, :json | |
| def show | |
| @something = Something.find(params[:id]) | |
| respond_with(@something) do |format| | |
| format.html { render :layout => 'report' } | |
| 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
| class Child < ActiveRecord::Base | |
| belongs_to :parent | |
| def method_missing method_name, *args, &block | |
| return super unless parent.respond_to? method_name | |
| parent.__send__ method_name | |
| 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
| devise_scope :admins do | |
| post '/sign_in', :to => "devise/sessions#create", :as => :admin_session | |
| delete '/sign_out', :to => "devise/sessions#destroy", :as => :destroy_admin_session | |
| end |