Skip to content

Instantly share code, notes, and snippets.

View juniormartinxo's full-sized avatar
😎
I may be slow to respond.

Junior Martins juniormartinxo

😎
I may be slow to respond.
View GitHub Profile

A classe ConflictInterceptor()

import { Injectable, NestInterceptor, ExecutionContext, CallHandler, ConflictException } from '@nestjs/common'
import { catchError, Observable } from 'rxjs'
import { ConflictError } from '../types/ConflictError'

@Injectable()
export class ConflictInterceptor implements NestInterceptor {
  intercept(context: ExecutionContext, next: CallHandler): Observable<any> {

Docker prune, rm e rmi

Apagdno todas as imagens no Docker

$ docker image rm -f $(docker image ls -q)

Apagando todos os volumes no Docker

@juniormartinxo
juniormartinxo / Cores no console.log().md
Last active August 18, 2022 17:12
Cores no console.log()

Textos

  • \033[1;33m Amarelo
  • \033[0;34m Azul
  • \033[1;34m Azul Claro
  • \033[1;37m Branco
  • \033[0;37m Cinza Claro
  • \033[0;36m Cyan
  • \033[1;36m Cyan Claro
  • \033[0;33m Marrom
  • \033[1;30m Preto Acinzentado

Error: connect ECONNREFUSED 127.0.0.1:80 at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16)

Stackoverflow (Obtendo a conexão ECONNREFUSED 127.0.0.1:80 ao tentar uma solicitação HTTP)

Acesse aqui

No meu caso, o problema era realmente o comportamento padrão do cliente HTTP que eu estava usando, axios. Por padrão, o axios nos redireciona 127.0.0.1:80se não encontrar o URL ou httpmétodo solicitado (GET/POST/PUT). Portanto, é melhor verificar sua URL se também estiver usando axios.

Erros NestJS

Erro - Nest can't resolve dependencies of the ...

ERROR [ExceptionHandler] Nest can't resolve dependencies of the UserRepository (?).
Please make sure that the argument PrismaService at index [0] is available in the UserModule context.

Solução

No caso acima seria adicionar PrismaService no no provider do @Module no arquivo user.module.

@juniormartinxo
juniormartinxo / ZSH no WSL.md
Last active January 3, 2023 22:42
ZSH no WSL.md

Instalar ZSH no WSL

Instalar o ZSH:

sudo apt install zsh

Instalar o Oh My Zsh

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Criar comandos no Linux editando o .bashrc

Edite o arquivo .bashrc

nano ~/.bashrc

Crie o alias dentro do .bashrc

alias nomeDoComando='digite aqui o comando que será executado'

Comandos git

Definir o Visual Studio Code como seu editor padrão

git config --global core.editor 'code --wait'

Erro permission denied: unknown ao rodar docker-compose

ERROR: for scraping-app Cannot start service app: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: ".docker/entrypoint.sh": permission denied: unknown ERROR: for app Cannot start service app: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: ".docker/entrypoint.sh": permission denied: unknown ERROR: Encountered errors while bringing up the project.

Resolver o erro:

chmod +x docker-entrypoint.sh