Skip to content

Instantly share code, notes, and snippets.

View ErikGMatos's full-sized avatar
:octocat:

Erik Garces Matos ErikGMatos

:octocat:
View GitHub Profile
.seletor {
display: flex;
align-items: center;
justify-content: center;
margin: 10px;
color: #fff;
font-size: 1rem;
}
module.exports = {
extends: [
'stylelint-config-recommended',
'stylelint-config-styled-components',
],
plugins: ['stylelint-order'],
sintax: 'css-in-js',
rules: {
'rule-empty-line-before': ['always', { except: 'first-nested' }],
'at-rule-empty-line-before': 'always',
.seletor {
display: flex;
margin: 10px;
font-size: 1rem;
align-items: center;
color: #fff;
justify-content: center;
}
module.exports = {
// lines above were suppressed
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: [
{
loader: 'babel-loader',
module.exports = {
extends: [
'stylelint-config-recommended',
'stylelint-config-styled-components',
],
sintax: 'css-in-js',
};
@ErikGMatos
ErikGMatos / cache.js
Created September 10, 2020 16:02
função que verifica qual requisição será colocada em cache
const URL_CACHED = [
/vendedores/,
/usuarios/,
];
export function getURLCached(req) {
const { url } = req;
const urlMapped = URL_CACHED.map(pattern => {
const patternRegexp = new RegExp(pattern);
return patternRegexp.test(url);
@ErikGMatos
ErikGMatos / api.js
Last active September 10, 2020 15:51
intância do axios com axios-cache-adapter
import { setup } from 'axios-cache-adapter';
import localforage from 'localforage';
import memoryDriver from 'localforage-memoryStorageDriver';
import { getURLCached } from './cache';
localforage.defineDriver(memoryDriver);
const localforageStore = localforage.createInstance({
driver: [localforage.LOCALSTORAGE, localforage.INDEXEDDB],
name: 'NOME_QUE APARECE_NO_LOCALSTORAGE',
// function to connect
const initLoad = useCallback(async () => {
if (!info) return history.push(commom.CONFIG_ERROR);
const room1 = await connect(info.joinInfo.attendee.jwtToken, {
video: { deviceId: videoInputDevice },
audio: { deviceId: audioInputDevice },
name: info.meetingId,
networkQuality: {
local: 2,
remote: 1,
@ErikGMatos
ErikGMatos / shortcuts.json
Created March 26, 2020 11:30
Teclas de atalho VsCode
[
{
"key": "alt+1",
"command": "extension.runJestFile",
},
{
"key": "alt+2",
"command": "extension.runJest",
},
{
import React, { useEffect, useState } from 'react';
import { Fade } from './styles';
export default function FadeComponent({ show, children }) {
const [render, setRender] = useState(show);
useEffect(() => {
if (show) setRender(true);
}, [show]);