Skip to content

Instantly share code, notes, and snippets.

View MarlonPassos-git's full-sized avatar

Marlon Passos MarlonPassos-git

View GitHub Profile
import type { FC, ReactElement } from 'react'
import { useEffect, useState } from 'react'
interface DomContentInterface {
children: ReactElement<any, any> | null
}
const DOMContentLoadedWrapper: FC<DomContentInterface> = ({ children }) => {
const [isReady, setIsReady] = useState(false)
@MarlonPassos-git
MarlonPassos-git / tsconfig.json
Created May 2, 2023 20:13
tsconfig to: nodejs, typescript, ESM, import json files
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"lib": ["ES2022"],
"moduleResolution": "node",
"resolveJsonModule": true,
"allowSyntheticDefaultImports": true,
"allowJs": true,
"outDir": "dist"
@MarlonPassos-git
MarlonPassos-git / instalar_cypress_wsl2.md
Created March 28, 2023 13:55 — forked from J-Pster/instalar_cypress_wsl2.md
Como instalar o Cypress no WSL2 (+ Puppeteer)

Instalando o Cypress no WSL 2 (+ Usando o Puppeteer em testes)

Depois de muito tempo sofrendo, finalmente descobri como instalar o Cypress de forma limpa e tranquila no WSL2, e vou te ensinar, e além disso, quando você instalar aqui o Cypress, testes que usam o Puppeteer que é a mesma dependência que o Cypress usa, também passarão a rodar no seu WSL2!

Esse tutorial é muito útil se você está tendo o erro error while loading shared libraries: libgbm.so.1: cannot open shared object file: No such file or directory ou algo parecido!

Créditos ao autor original, nesse link!

Antes de executar qualquer comando, ou código que eu tenha deixado aqui, tenta primeiro entender o que está escrito, e para os .sh, dê uma lida neles, mesmo que eu diga que seja seguro, é sempre bom olhar!

@MarlonPassos-git
MarlonPassos-git / index.js
Last active March 9, 2023 14:40
blocks translation of code blocks on the web
// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match *://*/*
// @grant none
// ==/UserScript==
@MarlonPassos-git
MarlonPassos-git / debounce.js
Created October 21, 2022 01:32
debounce with cancel and return
const debounce = (
{ delay },
func
) => {
let timer= null
let c = true
function debounced (...args) {
if (c) {
clearTimeout(timer)
timer = setTimeout(() =>{
@MarlonPassos-git
MarlonPassos-git / global.d.ts
Created October 7, 2022 01:19
types checkout m3
import { OrderForm } from "./orderForm"
import { ShippingSimutation } from "./shipping-simulation"
import { Store } from "./store"
declare global {
const vtexjs: {
checkout: {
orderForm: OrderForm,
orderFormId: string,
sendAttachment: (attachmentId: string, attachment: any, expectedOrderFormSections?: string[]) => Promise<OrderForm>
@MarlonPassos-git
MarlonPassos-git / style.json
Created September 20, 2022 16:33
vtex styles
{
"typeScale": [
3,
2.25,
1.5,
1.25,
1,
0.875,
0.75
],