Skip to content

Instantly share code, notes, and snippets.

View rponte's full-sized avatar
🏠
Working from home

Rafael Ponte rponte

🏠
Working from home
View GitHub Profile
@rponte
rponte / ParceladorDeFatura.java
Last active October 14, 2026 16:28 — forked from rafaelpontezup/ParceladorDeFatura.java
Quantos e quais cenarios/casos de testes você enxerga para o código da classe ParceladorDeFatura? (adiciona resposta nos comentarios)
package br.com.zup.edu.certificacoes.testing.parcelador;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.List;
public class ParceladorDeFatura {
public static final BigDecimal VALOR_MINIMO_FATURA = new BigDecimal("100");
@rponte
rponte / Palindromo.java
Created October 14, 2026 16:28 — forked from rafaelpontezup/Palindromo.java
Palindromo: exemplo de implementação e testes em Java
package br.com.zup.hackton.palindromo;
import org.apache.commons.lang3.StringUtils;
/**
* Algumas palavras e frases:
*
* ana, arara, mussum, mirim, ovo, reviver, socos, salas, ralar, e2e, 1-a-1
* anotaram a data da maratona
* socorram-me subi no onibus em marrocos
@rponte
rponte / CLAUDE.md
Created October 13, 2026 20:56
Example of CLAUDE.md for Java projects

Java / Spring Boot rules

Rules for new Java services built on Spring Boot with Web MVC, Validation, Data JPA and Security. Verified against official documentation on 2026-10-13 (sources at the end). These rules are for greenfield code only: every rule is mandatory, there are no legacy exceptions, and nothing is relaxed for compatibility with older code or older versions.

1. Baseline

  • Java 25 (current LTS, GA Sept 2025; next LTS is Java 29 in Sept 2027). Set
@rponte
rponte / 0-README.md
Last active October 13, 2026 20:57 — forked from leandronsp/ArquiteturaTest.java
Exemplo de CLAUDE.md e regras do Claude Code para um projeto Java com Spring Boot - by Leandro Proença (Extreme Loop)

Exemplo de CLAUDE.md

CLAUDE.md e regras do Claude Code para um projeto Java com Spring Boot. O domínio do exemplo (pedidos) é inventado; troque pelo seu.

O CLAUDE.md fica curto: comandos, regras gerais e o que o agente não deve fazer. As regras de cada assunto ficam em .claude/rules/, um arquivo por tema.

A regra de arquitetura também existe como teste. O ArquiteturaTest usa ArchUnit e quebra o build quando o pacote de domínio importa Spring, JPA ou Jackson, ou depende dos adaptadores.

@rponte
rponte / TransactionListener.java
Created September 18, 2026 13:18
A naive idempotent Kafka consumer written in Java and Spring Boot
package com.example.ledger;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.kafka.support.Acknowledgment;
import org.springframework.stereotype.Component;
import software.amazon.awssdk.services.dynamodb.DynamoDbClient;
import software.amazon.awssdk.services.dynamodb.model.AttributeValue;
@rponte
rponte / system_design_ticketmaster.md
Created June 16, 2026 10:44
System Design: Sistema tipo Ticketmaster e Ingressos.com
@rponte
rponte / incident-communication.md
Created March 26, 2026 23:47 — forked from hermogenes/incident-communication.md
Incident Communication Guide

Incident Communication Guide

For Small Teams

Purpose

This guide defines when to declare an incident, who is responsible for communication, and how to communicate externally during an incident.

It also defines how to act technically during an incident, emphasizing mitigation over fixes to reduce risk and downtime.

@rponte
rponte / export_dotenv_via_bash.sh
Created March 11, 2026 14:57
Python | Exporting .env variables via bash
export $(cat .env | xargs) && uv run main.py
@rponte
rponte / CreateChargeForCustomer.py
Last active May 15, 2025 01:07
Example of code in Python to create a charge for a specific customer
async def create_charge(charge: Charge, customer: Customer) -> None:
if not customer.is_active():
raise CustomerInactiveError("The customer is not active.")
if not charge.has_valid_amount():
raise InvalidChargeAmountError("The charge amount must be greater than zero.")
if not charge.has_valid_due_date():
raise InvalidDueDateError("The due date must be in the future.")
@rponte
rponte / 01-BookRequestTest.java
Last active February 22, 2025 02:19
Spring Boot Testing: How to test the Bean Validation annotations in domain and DTO objects without starting the whole Spring Boot Context
import org.assertj.core.groups.Tuple;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import jakarta.validation.ConstraintViolation;
import jakarta.validation.Validator;