Skip to content

Instantly share code, notes, and snippets.

View emersonlaurentino's full-sized avatar

Emerson Laurentino emersonlaurentino

View GitHub Profile
@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 }
];