Skip to content

Instantly share code, notes, and snippets.

View dlresende's full-sized avatar

Diego Lemos dlresende

View GitHub Profile

Fizz Buzz Kata

  1. If the number is divisible by 3, should print "Fizz"
  2. If the number is divisible by 5, should print "Buzz"
  3. If the number is divisible by both 3 and 5, should print "Fizz Buzz"
  4. Otherwise, should print the number

Example: 1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 Fizz Buzz ...

@dlresende
dlresende / tictactoe.rb
Created December 12, 2016 22:47
LSCC 2016-12-12
class Game
def initialize
@fields = "___" +
"___" +
"___" ;
end
def take(x, y, piece = "X")
line = x * 3

Fizz Buzz Kata

Build a program that takes a number N as input and for each number from 1 to N:

  • If the number is divisible by 3, should print "Fizz";
  • If the number is divisible by 5, should print "Buzz";
  • If the number is divisible by both 3 and 5, should print "Fizz Buzz";
  • Otherwise, should print the number.

Example:

@dlresende
dlresende / gist:d2faf9f0ebb2ed781749
Last active March 23, 2017 00:50
Roman Numerals Kata

Roman Numerals Converter Kata

Write a program to convert decimals to Roman numerals. Example:

  • roman(1) = "I"
  • roman(4) = "IV"
  • roman(1954) = "MCMLIV"
  • roman(1990) = "MCMXC"

Use the following table to make the correspondence between Roman numerals and decimals:

### Keybase proof
I hereby claim:
* I am dlresende on github.
* I am dlresende (https://keybase.io/dlresende) on keybase.
* I have a public key ASCxCa7Jty9zqQzI9lGZcFWDaRCPUhCRa5jyi_imbXHyZQo
To claim this, I am signing this object:
@dlresende
dlresende / gist:dc57f506e1ab1de7e7df
Last active September 3, 2018 16:49
Tic Tac Toe Kata

Tic Tac Toe Kata

The rules of the tic tac toe game are the following:

  • a game is over when all fields are taken
  • a game is over when all fields in a column are taken by a player
  • a game is over when all fields in a row are taken by a player
  • a game is over when all fields in a diagonal are taken by a player
  • a player can take a field if not already taken
  • players take turns taking fields until the game is over
  • there are two player in the game (X and O)
@dlresende
dlresende / gist:274194dd6ec993eb5ec5
Last active September 6, 2018 10:06
RPN Calculator Kata

RPN Calculator Kata

A RPN calculator program computes expressions written in RPN (Reverse Polish Notation). A RPN expression (or a postfix expression) is one of the following:

  • a number X, in which case the value of the expression is that of X;
  • a sequence of the form E1 E2 O, where E1 and E2 are postfix expressions and O is an arithmetic operation; in this case, the value of the expression is that of E1 O E2

The following are RPN expressions:

@dlresende
dlresende / why_om_ui_is_not_accessible.md
Last active October 20, 2018 12:07
Debug VirtualBox not correctly forwarding traffic on a multi-user machine

Problem

Cannot access OM running inside VirtualBox

Facts

box

  • The box has 2 interfaces one for each IP range
    eth0      Link encap:Ethernet  HWaddr 08:00:27:00:fb:33
              inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
    

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

---
name: redis-on-demand-broker
releases:
- name: &broker-release ((broker_release))
version: latest
- name: &service-adapter-release ((service_adapter_release))
version: latest
- name: routing
version: latest
uaac target https://pcf.$env.cf-app.com/uaa --skip-ssl-validation && uaac token owner get opsman pivotalcf -s ''