Skip to content

Instantly share code, notes, and snippets.

@FelixCoutinho
FelixCoutinho / Point.java
Last active January 13, 2023 17:16
Java Record Example
record Point(int x, int y) {}
@FelixCoutinho
FelixCoutinho / .editorconfig
Created October 17, 2020 15:36
EditorConfig - Exemplo
# http://bitabit.dev
root = true
[*]
max_line_length = 80
indent_style = space
indent_size = 2
tab_width = 2
end_of_line = lf
charset = utf-8
package code;
public class SuperDigitJava {
//We define super digit of an integer x using the following rules:
//If x has only 1 digit, then its super digit is x.
//Otherwise, the super digit of x is equal to the super digit of the digit-sum of x.
//Here, digit-sum of a number is defined as the sum of its digits.
public static void main(String[] args) {
@FelixCoutinho
FelixCoutinho / runserver.sh
Created November 10, 2016 16:49
Run DigestAPS Server
#!/bin/sh
cd /home/fcoutinho/Downloads/digestaps-master
python scripts/ntlmaps &
sudo find / -type f -iname "*.png" -print0 | sudo xargs -I {} -0 optipng -o5 -quiet -preserve -log optipng.log "{}"
@FelixCoutinho
FelixCoutinho / PagamentoServicePadrao.java
Created November 5, 2014 14:10
Serviço de Pagamento Padrão
package br.loja.service;
import java.math.BigDecimal;
import br.loja.dominio.ItemPedido;
import br.loja.dominio.Pedido;
import br.loja.repositorio.RepositorioPagamentos;
import br.loja.service.terceiros.GatewayPagamentoService;
public class PagamentoServicePadrao implements PagamentoService {
Eu como um Usuário desejo
fazer um pedido
usando meu carrinho.
Eu como um Usuário desejo que
meu pedido tenha itens semelhantes
aos itens do carrinho.
Eu como um Usuário desejo que meu
pedido tenha a quantidade de
@FelixCoutinho
FelixCoutinho / PedidoServicePadrao.java
Created November 4, 2014 14:41
Pedido Service Implementação Padrao
package br.loja.service;
import br.loja.dominio.Pagamento;
import br.loja.dominio.Pedido;
import br.loja.exceptions.PagamentoNaoAutorizadoException;
public class PedidoServicePadrao implements PedidoService {
private PagamentoService pagamentoService;
@FelixCoutinho
FelixCoutinho / .bowerrc
Created November 3, 2014 19:56
Alterar o diretório padrão
{
...
"directory": "assets/thirdparty"
...
}
@FelixCoutinho
FelixCoutinho / FormatadorDeMoeda.java
Created October 30, 2014 14:44
Formatador De Moeda
package br.loja.utilidades;
import java.text.NumberFormat;
public class FormatadorDeMoeda {
private static NumberFormat formatadorPadrao = NumberFormat.getCurrencyInstance();
public static String formatar(Double valor) {
formatadorPadrao.setMinimumFractionDigits(1);