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
View gist:2bde80805ec17a46b13eac44d9e4ccfb
### Keybase proof
I hereby claim:
* I am prodis on github.
* I am prodis ( on keybase.
* I have a public key ASBYWVy_Ip4Ln4bB3NQeUXJeiZScRB3HwNvoJh-_bbiT3Ao
To claim this, I am signing this object:
prodis / init_attributes.rb
Last active October 25, 2017 21:33
Module to initialize required attributes
View init_attributes.rb
module InitAttributes
def self.included(base)
base.send(:include, InstanceMethods)
module InstanceMethods
def initialize(attributes)
init_instance_variables(self.class.accessor_attributes, attributes)
init_instance_variables(self.class.reader_attributes, attributes)
prodis / blocks_procs_lambdas.txt
Last active August 29, 2015 14:21
Fernando's whiteboard
View blocks_procs_lambdas.txt
Difference between blocks, procs and lambdas.
Blocks are not objects and can't be manipulates as objects. With procs and lambdas is possible to
create objects that represents a block.
Procs and lambdas have the 'call' method, that executes the block code associated in their creation.
A proc behaves like a block, different of lambdas that behaves like a method. For that reason,
lambdas need to receive the exact number of parameters defined in your declaration.
prodis / gist:5728513
Last active December 18, 2015 04:49 — forked from kincorvia/gist:4540489
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'
prodis / alias_metodos_de_classe_01.rb
Created March 29, 2013 18:18
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
prodis / hash_values_01.rb
Last active December 11, 2015 23:58
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 /
Last active December 11, 2015 21:49
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 / recursividade_hash_01.xml
Last active March 14, 2017 11:48
Ruby Fundamental - Usando recursividade para alterar valores de hash
View recursividade_hash_01.xml
prodis / alias_metodos_01.rb
Created October 1, 2012 00:04
Ruby Fundamental - Alias para métodos em Ruby
View alias_metodos_01.rb
names = ["Akira", "Fernando", "Jose"]
names.length # => 3
names.size # => 3
prodis / Prodis.ExitPageConfirmer.js
Created May 26, 2012 08:14
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;