Skip to content

Instantly share code, notes, and snippets.

View GiuseppeMP's full-sized avatar
:shipit:
https://giuseppematheus.com/

Giuseppe Matheus GiuseppeMP

:shipit:
https://giuseppematheus.com/
View GitHub Profile
@GiuseppeMP
GiuseppeMP / nestjs-logger interceptor example
Created June 21, 2021 15:32
Example of an provider that intercep http serros and log them.
import {
CallHandler,
ExecutionContext,
Injectable,
Logger,
NestInterceptor,
} from '@nestjs/common'
import { Observable } from 'rxjs'
import { tap } from 'rxjs/operators'
@GiuseppeMP
GiuseppeMP / benchmark.js
Last active June 21, 2021 17:17
The computing price of escapping characters in strings that not needed.
function testingDoubleQuotes(){
console.time('doublequotes')
for (let i = 0; i < 10000000; i++) {
const string1 = "String One"
}
console.timeEnd('doublequotes')
}
function testingSingleQuotes(){
console.time('singlequotes')
for (let i = 0; i < 10000000; i++) {
PO + Áreas
história: (Negocio) (2 meses) - escrito, estudado, priorizado
Eu gostaria de comer sucrilhos ou vender coelhos
PO + Áreas (Input do refinemanto) INVEST
AC (Negocio) - 3 semanas
Quando alguém pedir um coelho
e tiver coelhos disponiveis
entao vendemos o coelho
import {
ArgumentsHost,
Catch,
ExceptionFilter,
HttpException,
HttpStatus,
} from '@nestjs/common'
@Catch()
+ or - allows control over the mapped type modifier (? or readonly). -? means must be all present, aka it removes optionality (?) e.g.:
type T = {
a: string
b?: string
}
// Note b is optional
const sameAsT: { [K in keyof T]: string } = {
@GiuseppeMP
GiuseppeMP / WIX-PRISMJS-README.md
Last active September 8, 2021 19:32
Wix - Code Snippets with Prismjs + Dracule Theme + Copy Button (jsx, java, Python, sql, ts, js, jsx)

Wix

Wix dont support code snippets with sintax highlight, thats very bad. So, a workaround is use prism.js with HTML Snippets.

Prismjs

https://prismjs.com

@GiuseppeMP
GiuseppeMP / colinha-de-bolso.cyp
Last active October 15, 2021 19:01
neo4j-gist
// subindo o neo4j local
// docker run \ ─╯
// --name nome-que-vc-quiser-do-container \
// -p 7474:7474 -p 7687:7687 \
// -d \
// -v $HOME/uma-folder-sua-pra-nao-perder-dados-do-container/data:/data \
// -v $HOME/uma-folder-sua-pra-nao-perder-dados-do-container/logs:/logs \
// -v $HOME/uma-folder-sua-pra-nao-perder-dados-do-container/import:/var/lib/neo4j/import \
// -v $HOME/uma-folder-sua-pra-nao-perder-dados-do-container/plugins:/plugins \
// --env NEO4J_AUTH=neo4j/test \
Note: this assumes you are using ZSH shell.
## Installation
Install [asdf](https://github.com/asdf-vm/asdf):
```
$ git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.4.0
$ echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.zshrc
$ echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.zshrc
{
"editor.fontFamily": "Cascadia Code, Roboto Mono, Fira Code, Menlo, Monaco, 'Courier New', monospace",
"editor.fontLigatures": true,
"maven.terminal.useJavaHome": true,
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"files.exclude": {
"**/.classpath": true,
"**/.project": true,
"**/.settings": true,
"**/.factorypath": true,
@GiuseppeMP
GiuseppeMP / vimrc-22-01-22
Created January 23, 2022 01:11
vim-stuffs
" Specify a directory for plugins
" - For Neovim: stdpath('data') . '/plugged'
" - Avoid using standard Vim directory names like 'plugin'
call plug#begin('~/.dotfiles/.vim/plugged')
" Shorthand notation; fetches https://github.com/junegunn/vim-easy-align
Plug 'junegunn/vim-easy-align'
" Think of sensible.vim as one step above 'nocompatible' mode: a universal set of defaults that (hopefully) everyone can agree on.
Plug 'tpope/vim-sensible'