Skip to content

Instantly share code, notes, and snippets.

View H4ad's full-sized avatar

Vinicius Lourenço H4ad

View GitHub Profile
@H4ad
H4ad / README.md
Last active January 12, 2023 17:43
Fast ISO String Generation

Results:

fromUnixToISOString x 3,258,470 ops/sec ±1.86% (85 runs sampled)
new Date().toISOString() x 1,408,158 ops/sec ±0.96% (90 runs sampled)
@H4ad
H4ad / benchmark.ts
Created January 8, 2023 15:14
Ogma Benchmark
// to run this file, install: npm i --save benchmark pino @ogma/logger @nestjs/common
// and then just run with: npx ts-node benchmark.ts
import { Logger } from '@nestjs/common';
import { Ogma } from '@ogma/logger';
import pino from 'pino';
import * as Benchmark from 'benchmark';
const suite = new Benchmark.Suite();
@H4ad
H4ad / ids-benchmark.ts
Created January 8, 2023 00:46
NestJS UUID to UID
// to run this file, install: npm i --save benchmark uuid uid [email protected]
// and then just run with: npx ts-node ids-benchmark.ts
import * as Benchmark from 'benchmark';
import { uid } from 'uid';
import * as uuid from 'uuid';
import * as nanoid from 'nanoid';
const suite = new Benchmark.Suite();
@H4ad
H4ad / benchmark.ts
Created January 7, 2023 15:09
NestJS Logger Benchmarks
// to run this file, copy this file inside an NestJS API
// then install: npm i --save benchmark
// then copy `better-logger.service.ts` and `better-console-logger.service.ts`.
// and then just run with: npx ts-node src/benchmark.ts
const Benchmark = require('benchmark');
import { Logger } from '@nestjs/common';
import { BetterLogger } from './better-logger.service';
@H4ad
H4ad / benchmark.ts
Last active February 2, 2023 23:02
MetadataScanner Benchmark
var Benchmark = require('benchmark');
import {
isConstructor,
isFunction,
} from '@nestjs/common/utils/shared.utils';
import { MetadataScanner } from '@nestjs/core';
import { Injectable } from '@nestjs/common/interfaces/injectable.interface';
var suite = new Benchmark.Suite();
@H4ad
H4ad / 00_RELEASE.md
Last active September 9, 2022 11:48
Autotag com Changelog

Autotag com Changelog

Para começar, você deve instalar as bibliotecas:

npm i --save-dev --save-exact auto-changelog @jsdevtools/version-bump-prompt @jsdevtools/ez-spawn capacitor-set-version cross-env

Dentro do package.json, você precisa criar o script chamado release, da seguinte forma:

@H4ad
H4ad / Sub - Inteligência Computacional.ipynb
Last active June 24, 2021 01:18
Sub - Inteligencia Computacional
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@H4ad
H4ad / s3-upload-iam-policy.json
Created January 14, 2021 18:45
S3 Upload IAM Policy - Minimal Permissions to Upload File with Presigned Post URL
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:AbortMultipartUpload",
"s3:PutObjectLegalHold"
@H4ad
H4ad / .README.md
Created August 24, 2020 02:37
NestJS Configurations

NestJS Configurations

This is my configurations for startup of NestJS Applications.

@H4ad
H4ad / .0.README.md
Last active September 28, 2024 20:29
Typeorm Configuration for NestJS

Typeorm Configurations

This is my configurations for Typeorm using NestJS.

File Structure

Follow the file structure above to use this configuration.

ormconfig.js