This file contains 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 SomeInstanceMethods | |
def self.included(base) | |
puts "Module #{self} has been included by #{base}." | |
end | |
def some_instance_method | |
puts "Some instance method..." | |
end | |
end |
This file contains 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
try | |
{ | |
// Algum código (provavelmente mais POG) | |
} | |
catch (Exception e) | |
{ | |
throw new Exception(e.Message); | |
} |
This file contains 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 'logger' | |
module CoolLog | |
def logger | |
@cool_log_logger ||= ::Logger.new(STDOUT) | |
end | |
def level | |
@cool_log_level ||= :info | |
end |
This file contains 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
function ExitPageConfirmer(message) { | |
this.message = message; | |
this.needToConfirm = false; | |
var myself = this; | |
window.onbeforeunload = function() { | |
if (myself.needToConfirm) { | |
return myself.message; | |
} |
This file contains 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
names = ["Akira", "Fernando", "Jose"] | |
names.length # => 3 | |
names.size # => 3 |
This file contains 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
<transaction> | |
<id>456</id> | |
<status>Aprovada</status> | |
<order_number>F2457</order_number> | |
<price>33.21</price> | |
<date_transaction>2012-12-13T12:35:30</date_transaction> | |
<date_release></date_release> | |
<payment> | |
<payment_method>Mastercard</payment_method> | |
<date_approval>2012-12-13T12:35:31</date_approval> |
This file contains 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
#!bash | |
# | |
# bash completion support for core Git. | |
# | |
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org> | |
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/). | |
# Distributed under the GNU General Public License, version 2.0. | |
# | |
# The contained completion routines provide support for completing: | |
# |
This file contains 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
my_hash[:status] if my_hash | |
# or | |
my_hash[:status] unless my_hash.nil? |
This file contains 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
# You didn't write this code | |
class ExternalClass | |
def self.class_number | |
123 # Just to exemplify | |
end | |
def some_number | |
456 # Just to exemplify | |
end | |
end |
This file contains 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
# Typically in Rails to use VCR we setup the RSpec config like so: | |
RSpec.configure do |config| | |
config.extend VCR::RSpec::Macros #deprecated | |
end | |
# This gives us access to the use_vcr_cassette method: | |
describe Reviewed::Article do | |
use_vcr_cassette 'article/grill' | |
end | |