Skip to content

Instantly share code, notes, and snippets.

View eminetto's full-sized avatar
:octocat:
always learning

Elton Minetto eminetto

:octocat:
always learning
View GitHub Profile
@eminetto
eminetto / api.go
Last active September 8, 2022 23:37
api.go
const TIMEOUT = 30 * time.Second
//Start a new http server with graceful shutdown and default parameters
func Start(l *logger.Logger, port string, handler http.Handler, options ...ServerOption) error {
srv := &http.Server{
ReadTimeout: TIMEOUT,
WriteTimeout: TIMEOUT,
Addr: ":" + port,
Handler: handler,
}
@eminetto
eminetto / architectural-kata.md
Last active July 29, 2022 18:22
All Stuff, No Cruft

All Stuff, No Cruft

O organizador de conferências precisa de um sistema de gerenciamento para as conferências que ele administra, tanto para palestrantes quanto para participantes.

Usuários

Centenas de palestrantes, dezenas de funcionários do evento, milhares de participantes

Requisitos:

@eminetto
eminetto / main.go
Created June 7, 2022 13:47
Exemplo de graceful shutdown
package main
import (
"context"
"fmt"
"log"
"net/http"
"os"
"os/signal"
"syscall"
package main
import (
"fmt"
"time"
)
func main() {
errs := make(chan error, 3)
go upload(errs)
@eminetto
eminetto / rfc.md
Created May 22, 2021 13:04
Template of RFCs

Title

Problem description

We must explain the problem clearly and identify additional details that the team needs to know. We must here describe the context, what we did so far, and the current state.

The description also serves as a trail that we can go back to in the future to understand the reasoning we had at the time and see what restrictions and requirements have changed.

Possible approaches

@eminetto
eminetto / rfc.md
Created May 15, 2021 15:42
Template de RFC

Título

Descrição do problema

Devemos explicar o problema claramente e identificar detalhes adicionais que a equipe precise saber. Devemos aqui descrever o contexto, o que foi feito até agora e o estado atual.

A descrição também serve como uma trilha à qual podemos voltar no futuro para entender o raciocínio que tínhamos na época e ver quais restrições e requisitos mudaram.

Possíveis abordagens

@eminetto
eminetto / can.go
Last active June 5, 2020 12:08
can.go
//this way?
func CanSubscribe(userID int, courseID int) bool {
}
//this way?
func CanSubscribe(userID int, courseID int) error {
//if can't subscribe return an error
//if can return nil
//if there's an error, like a database connection error, return the error itself
@eminetto
eminetto / dicas_hugo.md
Last active March 23, 2020 17:03
dicas hugo

Dividir o texto entre página incial e o conteúdo

Criar novo conteúdo

hugo new post/2016-07-22-como-usamos-o-slack-na-coderockr.md

Testar localmente