Skip to content

Instantly share code, notes, and snippets.

View LucasBadico's full-sized avatar

Lucas Badico LucasBadico

View GitHub Profile
@LucasBadico
LucasBadico / app.js
Last active February 8, 2023 20:17
Introdução a Banco de Dados - parte 1 | Encontro de Código
const express = require("express");
const fs = require("fs");
const path = require("path");
const app = express();
const port = process.env.PORT || 3000;
const dataFilePath = path.join(__dirname, "data.json");
// Função para ler os dados do arquivo JSON
const readData = () => {
@LucasBadico
LucasBadico / notifier.ts
Created February 25, 2023 02:00
objeto vs tipo
class Notifier {
private subscribers: ((notification: Notification) => void)[] = [];
constructor(subscribers: ((notification: Notification) => void)[]) {
this.subscribers = subscribers;
}
public notify(notification: Notification) {
this.subscribers.forEach((subscriber) => subscriber(notification));
}
@LucasBadico
LucasBadico / delete.go
Created December 20, 2023 01:56
GOLANG CONCURRENCY MODEL EXAMPLE
// CODE EXAMPLE FROM YOUTUBE LIVE: Golang: Modelo de concorrencia goroutine + channels
// LINK: https://youtube.com/live/TRx3W4mLFf8
// Lucas_Badico: Dev, mentor e apaixonado por Programacao
// SIGA ME EM TODAS AS REDES SOCIAIS
package main
import (
"time"
"fmt"
"sync"