Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
always learning

Elton Minetto eminetto

:octocat:
always learning
View GitHub Profile
View eleicao.go
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"time"
)
View eleicao_color.go
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"time"
"github.com/charmbracelet/lipgloss"
View service_test.go
package service_test
import (
"testing"
"github.com/PicPay/example"
)
func TestFindAll(t *testing.T) {
s := example.NewService()
all, err := s.FindAll()
View service.go
package service
//NewService create new service
func NewService() *Service {
return &Service{}
}
//FindAll
func (s *Service) FindAll() ([]*entity.Privilege, error) {
acl := s.getDefaultPrivileges()
@eminetto
eminetto / rfc.md
Created May 22, 2021
Template of RFCs
View rfc.md

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

View 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 / profundo.c
Created Sep 8, 2022
Módulo profundo
View profundo.c
int open(const char* path, int flags, mode_t permissions);
int close(int fd);
ssize_t read(int fd, void* buffer, size_t count);
ssize_t write(int fd, const void* buffer, size_t count);
off_t lseek(int fd, off_t offset, int referencePosition);
View raso.java
FileInputStream fileStream = new FileInputStream(fileName);
BufferedInputStream bufferedStream = new BufferedInputStream(fileStream);
ObjectInputStream objectStream = new ObjectInputStream(bufferedStream);
@eminetto
eminetto / architectural-kata.md
Last active Jul 29, 2022
All Stuff, No Cruft
View architectural-kata.md

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 Jun 7, 2022
Exemplo de graceful shutdown
View main.go
package main
import (
"context"
"fmt"
"log"
"net/http"
"os"
"os/signal"
"syscall"