Skip to content

Instantly share code, notes, and snippets.

View moatorres's full-sized avatar
👋

Moa Torres moatorres

👋
  • 23:45 (UTC -03:00)
View GitHub Profile
@moatorres
moatorres / Member.ts
Last active March 19, 2022 18:33
Sequelize + Typescript Setup
module.exports = (sequelize: any, DataTypes: any) => {
const Member = sequelize.define(
'member',
{
id: {
type: DataTypes.UUID,
defaultValue: DataTypes.UUIDV4,
allowNull: false,
primaryKey: true,
},
@moatorres
moatorres / remove-docker.sh
Created March 21, 2022 13:56
Docker Removal (macOSX)
#!/bin/bash
sudo rm -Rf /Applications/Docker.app
sudo rm -f /usr/local/bin/docker
sudo rm -f /usr/local/bin/docker-machine
sudo rm -f /usr/local/bin/com.docker.cli
sudo rm -f /usr/local/bin/docker-compose
sudo rm -f /usr/local/bin/docker-compose-v1
sudo rm -f /usr/local/bin/docker-credential-desktop
sudo rm -f /usr/local/bin/docker-credential-ecr-login
@moatorres
moatorres / proxyTrack.js
Created July 24, 2022 19:28 — forked from mrharel/proxyTrack.js
Using Proxy to Track Javascript Class
const callerMap = {};
function getCaller(error) {
if (error && error.stack) {
const lines = error.stack.split('\n');
if (lines.length > 2) {
let match = lines[2].match(/at ([a-zA-Z\-_$.]+) (.*)/);
if (match) {
return {
name: match[1].replace(/^Proxy\./, ''),
[
{
"code": 100,
"name": "Continue",
"enum": "CONTINUE",
"reference": {
"info": "RFC 7231, Section 6.2.1",
"url": "https://tools.ietf.org/html/rfc7231#section-6.2.1"
},
"description": "The server has received the request headers and the client should proceed to send the request body",
@moatorres
moatorres / interceptor.ts
Created November 6, 2023 22:43
Interceptor Decorator
/**
* Interceptor interface for intercepting method calls, requests, responses, process, and errors.
*/
export interface Interceptor {
before?(...args: any[]): Promise<void> | void
after?<T>(result: T, ...args: any[]): Promise<void> | void
error?(error: Error, ...args: any[]): Promise<void> | void
shouldThrow?: boolean
}