Skip to content

Instantly share code, notes, and snippets.

Writing code that generates business value

Fernando Hamasaki de Amorim prodis

Writing code that generates business value
View GitHub Profile
prodis / modulos_hooks_01.rb
Created Mar 31, 2012
Ruby Fundamental - Hooks (ganchos) de inclusão e extensão de módulos
View modulos_hooks_01.rb
module SomeInstanceMethods
def self.included(base)
puts "Module #{self} has been included by #{base}."
def some_instance_method
puts "Some instance method..."
View PogClassica.cs
// Algum código (provavelmente mais POG)
catch (Exception e)
throw new Exception(e.Message);
prodis / modulos_metodos_globais_01.rb
Created Apr 30, 2012
Ruby Fundamental - Módulos para definir métodos globais
View modulos_metodos_globais_01.rb
require 'logger'
module CoolLog
def logger
@cool_log_logger ||=
def level
@cool_log_level ||= :info
prodis / Prodis.ExitPageConfirmer.js
Created May 26, 2012
JavaScript exit page confirmer object
View Prodis.ExitPageConfirmer.js
function ExitPageConfirmer(message) {
this.message = message;
this.needToConfirm = false;
var myself = this;
window.onbeforeunload = function() {
if (myself.needToConfirm) {
return myself.message;
prodis / alias_metodos_01.rb
Created Oct 1, 2012
Ruby Fundamental - Alias para métodos em Ruby
View alias_metodos_01.rb
names = ["Akira", "Fernando", "Jose"]
names.length # => 3
names.size # => 3
prodis / recursividade_hash_01.xml
Last active Mar 14, 2017
Ruby Fundamental - Usando recursividade para alterar valores de hash
View recursividade_hash_01.xml
prodis /
Last active Dec 11, 2015
Mac configuration files
# bash completion support for core Git.
# Copyright (C) 2006,2007 Shawn O. Pearce <>
# Conceptually based on gitcompletion (
# Distributed under the GNU General Public License, version 2.0.
# The contained completion routines provide support for completing:
prodis / hash_values_01.rb
Last active Dec 11, 2015
Ruby Fundamental - Uma maneira não trivial de acessar valores de hash
View hash_values_01.rb
my_hash[:status] if my_hash
# or
my_hash[:status] unless my_hash.nil?
prodis / alias_metodos_de_classe_01.rb
Created Mar 29, 2013
Ruby Fundamental - Alias para métodos de classe
View alias_metodos_de_classe_01.rb
# You didn't write this code
class ExternalClass
def self.class_number
123 # Just to exemplify
def some_number
456 # Just to exemplify
View gist:5728513
# Typically in Rails to use VCR we setup the RSpec config like so:
RSpec.configure do |config|
config.extend VCR::RSpec::Macros #deprecated
# This gives us access to the use_vcr_cassette method:
describe Reviewed::Article do
use_vcr_cassette 'article/grill'