Skip to content

Instantly share code, notes, and snippets.

View matteolobello's full-sized avatar
👨‍💻
Coding

Matteo Lobello matteolobello

👨‍💻
Coding
View GitHub Profile
We can make this file beautiful and searchable if this error is corrected: It looks like row 7 should actually have 9 columns, instead of 8. in line 6.
Name,Frontend,Backend,Storage,Database,Socket,Developer Experience,Positive Notes,Negative Notes
AWS,✅ (S3 + CloudFront),✅ (Lambda / Fargate / Elastic BeansTalk),✅ (S3),"✅ (DynamoDB, RDS)",✅,⚠️,"Robust platform, Serverless framework can usually make deployments easier","Costs are often hard to predict, relational DBs are pricey while structuring data with DynamoDB might be complex, the Serverless framework is nice but has some bugs (e.g. serverless-offline plugin postToConnection is not currently working)"
BackBlaze,✅,❌,✅,❌,❌,✅,"Cheap storage solution, part of CloudFlare Bandwidth Alliance",Slightly slower than S3
CloudFlare,✅ (Pages),✅ (Workers),✅ (R2), ❌,✅,✅,"Edge Computing, competitive pricing","Workers run in a V8 environment, so many Node.js packages won't work"
Deta,❌,✅,✅,✅,❌,✅,It's free to use,Still experimental-ish
Digital Ocean,✅ (App Platform),✅ (App Platform),✅ (Spaces),✅ (Managed DB),✅ (needs Redis),✅,Predictable pricing,High costs
FaunaDB,❌,❌,❌,✅,❌,⚠️,Horizontally scalable and globally distribute
@matteolobello
matteolobello / generate-types-with-prisma.sh
Last active November 19, 2021 13:12
Pull Prisma schema directly from the Database and generate the corresponding types
#!/bin/bash
TEMPLATE="$(
cat <<-EOF
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "$DB_PROVIDER"
url = env("DB_URI")
@matteolobello
matteolobello / App.test.ts
Last active November 3, 2023 07:48
UI Testing TypeScript React apps with Puppeteer and Jest
import puppeteer from "puppeteer"
let browser: puppeteer.Browser | undefined
let page: puppeteer.Page | undefined
const sleep = async (ms: number) =>
await new Promise((res) => setTimeout(res, ms))
beforeAll(async () => {
browser = await puppeteer.launch({
@matteolobello
matteolobello / clock-element.js
Last active January 20, 2020 09:44
WebComponents
// Declaring our Custom Element class.
// NOTE: element classes can extend to
// HTMLElement, HTMLButtonElement, HTMLParagraphElement, ...
class ClockElement extends HTMLElement {
// First method that will be
// executed on object initialization
constructor() {
// Run HTMLElement's constructor to setup basic stuff
super()
@matteolobello
matteolobello / app.js
Last active September 6, 2020 12:25
Auth with NodeJS, Express, Mongoose and JWT
const Express = require("express")
const JsonWebToken = require("jsonwebtoken")
const BodyParser = require("body-parser")
const Bcrypt = require("bcryptjs")
const Database = require("./db")
const SERVER_PORT = process.env.PORT || 80
const SECRET_JWT_CODE = "psmR3HuOihHKfqZymo1m"
@matteolobello
matteolobello / README.md
Last active December 18, 2018 10:51
Java Sockets

Java Sockets

Example of how Sockets work in Java

@matteolobello
matteolobello / DSStoreRemover.java
Last active June 29, 2018 12:49
Program to delete all .DS_Store in a path and its sub-path
import java.io.File;
import java.util.ArrayList;
import java.util.Scanner;
public class DSStoreRemover {
private static final ArrayList<File> filesArrayList = new ArrayList<>();
public static void main(String[] args) {
System.out.println("Drag & Drop folder here: ");
@matteolobello
matteolobello / LinesCounter.java
Last active June 29, 2018 12:58
A small Java program to count the number of lines in files in a directory and its subdirectories.
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Scanner;
public class LinesCounter {