Skip to content

Instantly share code, notes, and snippets.

View guilhermesilveira's full-sized avatar

Guilherme Silveira guilhermesilveira

View GitHub Profile
#define TAMANHO_MAXIMO_DO_SEGREDO 4
#define REPETICOES_ESTADO_FINAL 3
#define TEMPO_LUZ 1000
#define TEMPO_PAUSA 500
#define ledVerde 2
#define ledAmarelo 3
#define ledVermelho 4
#define ledBranco 5
@guilhermesilveira
guilhermesilveira / robot.js
Created December 5, 2012 16:55 — forked from fabiopimentel/robot.js
[CAELUM TEAM]Megatron
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.clone();
Conta conta = new Conta(900);
Cliente cliente = new Cliente();
// DSL bacana
cliente.debita(500).da(conta);
println(conta saldo);
// classes
class Cliente {
Debito debita(int valor) { return new Debito(valor); }

2010 Modularity Olympics

This is a contest, open to programming languages from all nations, to write modular and extensible code to solve the following problem: Implement a service that can run queries on a database.

The Challenge

Sounds simple right? Wrong! A programmer without control over the source-code of that service must be able to later add enhancements such as statistics collecting, timeouts, memoization, and so forth. There are a few more requirements:

  1. the “enhancements” must be specified in a configuration object which is consumed at run-time (e.g., it could be based on user-input).
  2. The enhancements are ordered (stats collecting wraps timeouts, not the other way around) but it must be possible to reverse the order of the enhancements at run-time.
  3. The enhancements must be “surgical” and not “global”. That is, it must be possible to simultaneously have two query services, one reversed and one not reversed, and even have a query service without any enhancements.