Skip to content

Instantly share code, notes, and snippets.

@Klerith
Klerith / random-hex.md
Created September 22, 2023 17:47
Secure Random Hex
View random-hex.md

Comando con Ruby instalado

ruby -rsecurerandom -e 'puts SecureRandom.hex(20)'

Ejemplo: No usar en producción

4510c8cf2fe423f8be5afccbdd30c678677e172b

@Klerith
Klerith / seed-data.ts
Last active September 19, 2023 16:01
Información para poblar la base de datos
View seed-data.ts
import { bcryptAdapter } from '../../config';
export const seedData = {
users: [
{ name: 'Test 1', email: 'test1@google.com', password: bcryptAdapter.hash( '123456') },
{ name: 'Test 2', email: 'test2@google.com', password: bcryptAdapter.hash( '123456') },
{ name: 'Test 3', email: 'test3@google.com', password: bcryptAdapter.hash( '123456') },
@Klerith
Klerith / docker-compose.yml
Created September 15, 2023 18:24
Docker compose para levantar una base de datos MongoDB
View docker-compose.yml
version: '3.8'
services:
mongo-db:
image: mongo:6.0.6
restart: always
environment:
MONGO_INITDB_ROOT_USERNAME: mongo-user
@Klerith
Klerith / regular-exp.ts
Created September 15, 2023 16:38
Validadores usando expresiones regulares
View regular-exp.ts
export class Validators {
static get email() {
return /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/;
}
}
@Klerith
Klerith / instalaciones-linkedin-node.md
Last active September 15, 2023 14:48
Instalaciones recomendadas para el curso de Node - CleanArchitecture para LinkedIn
@Klerith
Klerith / settings.json
Created September 11, 2023 19:22
Configuración de VSCode
View settings.json
{
"editor.tabSize": 2,
"editor.detectIndentation": false,
"editor.insertSpaces": true,
"terminal.integrated.fontFamily": "MesloLGM NF",
"explorer.compactFolders": false,
"workbench.iconTheme": "material-icon-theme",
"material-icon-theme.activeIconPack": "qwik",
"workbench.startupEditor": "none",
"workbench.colorCustomizations": {
@Klerith
Klerith / regular-exp.ts
Created September 9, 2023 16:55
Email Validation
View regular-exp.ts
export const regularExps = {
// email
email: /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/,
}
@Klerith
Klerith / .env
Last active September 4, 2023 19:59
.env y docker compose para Postgres
View .env
PORT=3000
PUBLIC_PATH=public
POSTGRES_URL=postgresql://postgres:123456@localhost:5432/TODO
POSTGRES_USER=postgres
POSTGRES_DB=TODO
POSTGRES_PORT=5432
POSTGRES_PASSWORD=123456
@Klerith
Klerith / self-certificates.sh
Last active September 2, 2023 15:09
Generar certificados
View self-certificates.sh
openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout server.key -out server.crt
@Klerith
Klerith / configurar-node-ts.md
Last active September 26, 2023 07:20
Node con TypeScript - TS-Node-dev simplificado
View configurar-node-ts.md

Node con TypeScript - TS-Node-dev (preferido)

  1. Instalar TypeScript y demás dependencias
npm i -D typescript @types/node ts-node-dev rimraf
  1. Inicializar el archivo de configuración de TypeScript ( Se puede configurar al gusto)
npx tsc --init --outDir dist/ --rootDir src