Skip to content

Instantly share code, notes, and snippets.

View GiuseppeMP's full-sized avatar
:copilot:
Making sure gas and oil don’t get lost on the way 🦖🦖

Giuseppe Matheus (Beppe) GiuseppeMP

:copilot:
Making sure gas and oil don’t get lost on the way 🦖🦖
View GitHub Profile
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
@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 \
@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

+ 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 } = {
import {
ArgumentsHost,
Catch,
ExceptionFilter,
HttpException,
HttpStatus,
} from '@nestjs/common'
@Catch()
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
@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++) {
@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 / mock-type-with-jest.ts
Created June 18, 2021 14:25
Como mockar usando jest e type auxiliar
export type MockType<T> = {
[P in keyof T]?: jest.Mock<unknown>;
};
const mockKnexConnection : () => MockType<Knex<any, unknown>>
= jest.fn(() => ({
destroy: jest.fn(() => { console.log }),
raw: jest.fn((query) => {
return new Promise<any>( (res) => {
res(query)
@GiuseppeMP
GiuseppeMP / jest-eslint.config.js
Created June 17, 2021 22:59 — forked from wldcordeiro/jest-eslint.config.js
Jest Multi Project Example
const { resolve } = require('path')
const root = resolve(__dirname, '..')
module.exports = {
rootDir: root,
displayName: 'eslint',
runner: 'jest-runner-eslint',
testMatch: ['<rootDir>/src/**/*.js', '<rootDir>/config/*.js'],
}