Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
always learning

Elton Minetto eminetto

:octocat:
always learning
View GitHub Profile
View eleicao_color.go
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"time"
"github.com/charmbracelet/lipgloss"
View eleicao.go
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"time"
)
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 / 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);
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 / 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"
View goroutine.go
package main
import (
"fmt"
"time"
)
func main() {
errs := make(chan error, 3)
go upload(errs)