Skip to content

Instantly share code, notes, and snippets.

View emersonlaurentino's full-sized avatar

Emerson Laurentino emersonlaurentino

View GitHub Profile
/**
* Before running this code, you need to run this script on the web page:
* urls = []
document.querySelectorAll(".src-components-Client-Common-___Common__photo___3yTw5 > img").forEach((item) => {
const url = item.src.replace("alfred.alboompro.com/resize/width/300/url/", "")
if (!urls.includes(url)) {
urls.push(url)
}
})
* after that, copy the urls array and paste it in the urls variable below
@emersonlaurentino
emersonlaurentino / letters.json
Last active January 4, 2022 19:07
Palavras Cruzadas
{
"empty": {
"points": 0,
"quantity": 3
},
"a": {
"points": 1,
"quantity": 10
},
"ã": {
Monday: 18
Tuesday: 17
Wednesday: 16
Thursday: 14
Friday: 12
import type { SxStyleProp } from '@vtex/store-ui'
import { Spinner, UIButton } from '@vtex/store-ui'
import type { ComponentPropsWithoutRef, FC } from 'react'
import React from 'react'
interface Props extends ComponentPropsWithoutRef<typeof UIButton> {
loading: boolean
}
const defaultStyles: SxStyleProp = {
@emersonlaurentino
emersonlaurentino / machine.js
Last active October 14, 2020 13:40
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@emersonlaurentino
emersonlaurentino / App.tsx
Created October 9, 2020 15:05
Lazy Scripts
import React, { FC, lazy, Suspense, useEffect, useState } from 'react'
const preloadComponent = () => import('./Component')
const Component = lazy(preloadDrawer)
const App: FC = () => {
useEffect(() => {
const handler = window.requestIdleCallback(preloadComponent)
unbindall
bind "0" "slot10"
bind "1" "slot1"
bind "2" "slot2"
bind "3" "slot3"
bind "4" "slot4"
bind "5" "slot5"
bind "6" "slot6"
bind "7" "slot7"
bind "8" "slot8"
@emersonlaurentino
emersonlaurentino / example.tsx
Created February 11, 2020 20:22
React Intl with Hook
import React from 'react'
import { useIntl } from 'react-intl'
const AdminForm = () => {
const intl = useIntl()
return (
<form>
<label>
<small>{intl.formatMessage({ id: 'admin/username.form.label' })}</small>
@emersonlaurentino
emersonlaurentino / sendMessageInstagram.js
Last active December 5, 2019 15:12
send message by pressing enter on instagram web
// script
function sendMessageInstagram (e) {
if (e.keyCode === 13) {
document.querySelector('.X3a-9 button').click();
}
};
// execute
addEventListener("keyup", sendMessageInstagram);
// Recíproca de Simpson
const DADOS = [
{ especie: 'A', individuos: 100 },
{ especie: 'B', individuos: 150 },
{ especie: 'C', individuos: 20 },
{ especie: 'D', individuos: 35 },
{ especie: 'E', individuos: 48 }
];