Skip to content

Instantly share code, notes, and snippets.

View diegodfsd's full-sized avatar
🎯
Focusing

Diego Dias diegodfsd

🎯
Focusing
View GitHub Profile
@diegodfsd
diegodfsd / transaction.rb
Created July 15, 2011 22:47 — forked from felipero/transaction.rb
Bad Single Responsibility Principle Example
#params = Parameter.new "registration", "0000000000000000"
#transaction = Transaction.create! params, connection
module Integration
class Transaction
attr_reader :data
def initialize(data)
@data = data
end
@diegodfsd
diegodfsd / howto.js
Created November 6, 2011 02:51 — forked from marcric/howto.js
cumulative export example
// node.js exercise
function privateSay(message) {
console.log("private: ", message);
};
function say(message) {
console.log("public: ", message);
};
function User(name) {
@diegodfsd
diegodfsd / gist:1379740
Created November 20, 2011 02:45 — forked from mperham/gist:1379464
Flexibility without Dependency Injection
class TaxCode
GENERATORS = {
:us => lambda { |id| "US-#{id}" },
:br => lambda { |id| "#{id + 9}-BRA" }
}
def self.generate(code, id)
gen = GENERATORS[code] || raise ArgumentError, "No generator for country #{code}"
gen.call(id)
end
@diegodfsd
diegodfsd / gist:1419071
Last active September 28, 2015 09:37 — forked from FabioRodrigues/gist:1418984
DesabilitarNós
;function checkboxUtil(){
var input
, init;
this.init = function(seletor){
input = $("form input:checkbox");
var self = this;
input.live('click', function () {
var elemento = $(seletor);
@diegodfsd
diegodfsd / gist:5980920
Last active December 19, 2015 15:59 — forked from matthewmccullough/gist:47267
bash_profile customizado que exibe versão do ruby, path e gitstatus
#!/bin/bash
# Load RVM function
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
########################################################################
# Matthew's Git Bash Prompt
########################################################################
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
@diegodfsd
diegodfsd / 0_reuse_code.js
Last active August 29, 2015 14:08
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console