Skip to content

Instantly share code, notes, and snippets.

View chrisvasqm's full-sized avatar

Christian Vasquez chrisvasqm

View GitHub Profile
@chrisvasqm
chrisvasqm / jsconfig.json
Last active April 3, 2025 19:44
Cypress jsconfig.json
{
"compilerOptions": {
"target": "es6",
// "checkJs": true, Enables type checking for JS files
"allowJs": true, // Allows JS files to be included
"types": ["cypress"]
},
"include": [
"cypress/**/*.js" // Path to your Cypress test files
],
@chrisvasqm
chrisvasqm / node-error-handlers.js
Last active August 4, 2024 23:51
Node Express Error Handlers
import express from 'express';
import 'express-async-errors';
const app = express();
// Node Global Error Handlers
process.on('uncaughtException', exception => {
console.error('Uncaught Exception: ', exception.stack);
});
services:
database:
image: mongo
container_name: mongodb
ports:
- 27017:27017
volumes:
- mongo-data:/data/db
networks:
- mongo-network
@chrisvasqm
chrisvasqm / eslint.config.js
Created June 8, 2024 20:06
Flat ESLint Config file for JavaScript
import globals from "globals";
export default [
{
languageOptions: {
ecmaVersion: 2022,
sourceType: "module",
globals: globals.node
}
}
@chrisvasqm
chrisvasqm / .dockerignore
Created June 6, 2024 22:30
Sample .dockerignore for a Node project
dist
node_modules
.git
.env
*.log
Dockerfile
docker-compose.yaml
.vscode
.idea
test
@chrisvasqm
chrisvasqm / deploy.sh
Created June 1, 2024 04:35
Sample deployment script to use with a Virtual Machine setup (Linode, Digital Ocean Droplets, etc)
echo "Switching to master branch"
git checkout master
echo "Building app..."
pnpm build
echo "Deploying files to server..."
scp -r dist/* app@<DOMAIN_OR_IP>:/var/www/<DOMAIN_OR_IP>/
echo "Deployment done!"
@chrisvasqm
chrisvasqm / s3-delete-script.js
Created May 31, 2024 20:40
Delete objects from S3 while excluding some
const aws = require('aws-sdk');
// Configure the AWS SDK with your credentials
aws.config.update({
accessKeyId: 'ACCESS_KEY',
secretAccessKey: 'SECRET_ACCESS_KEY',
region: 'REGION'
});
// Create an S3 service object
@chrisvasqm
chrisvasqm / frontend-backend-database-compose.yml
Created May 27, 2024 11:56
Demostration docker-compose.yml file for a project with a Frontend + Backend+ Database setup to make local development easier
services:
db:
image: mongo:4.0-xenial
ports:
- 27017:27017
volumes:
- vidly:/data/db
api:
build: ./backend
@chrisvasqm
chrisvasqm / tsconfig.json
Last active May 25, 2024 16:28
Sample tsconfig.json file to convert a JavaScript project to TypeScript (Tip: Remove the "module" property from your package.json if you have it)
{
"compilerOptions": {
"module": "NodeNext",
"moduleResolution": "NodeNext",
"target": "ES2020",
"sourceMap": true,
"outDir": "dist"
},
"include": [
"*"
services:
postgres:
image: postgres:16.3-alpine3.20
container_name: appname
ports:
- '5432:5432'
environment:
POSTGRES_DB: appname
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres