Skip to content

Instantly share code, notes, and snippets.

View guilhermemarconi's full-sized avatar

Guilherme Marconi guilhermemarconi

  • Brazil
  • 06:46 (UTC -03:00)
View GitHub Profile
@guilhermemarconi
guilhermemarconi / clickOutside.js
Created January 11, 2020 20:28
Interact with element when clicking outside of it
const $wrapper = $('.my-element');
$(document).on('click', e => {
if (!$wrapper.is(e.target) && $wrapper.has(e.target).length === 0) {
// do your stuff
}
});
/**
* Monta uma estrutura de classes CSS usando a metotologia BEM.
* @param {string} block
* Bloco base da classe CSS. Se passar apenas ele, retorna um construtor.
* @param {string} element
* @param {string[]} modifiers
* @returns {string|() => string}
* Classes CSS ou construtor baseado no bloco.
* @example
* const ordinaryClasses = mountBEMClass('block', 'element', 'modifier1', 'modifier2');
@guilhermemarconi
guilhermemarconi / App.js
Last active September 2, 2020 21:33
Bullets Tracking
import React, { useState } from 'react';
import Section from './Section';
import Bullets from './Bullets';
const images = ['01', '02', '03', '04', '05'];
function App() {
const [activeSection, setActiveSection] = useState(0);
@guilhermemarconi
guilhermemarconi / 404.html
Last active November 19, 2020 18:41
Rich Relevance Tracking Codes (VTEX)
<script charset="utf-8" type="text/javascript" async>
try {
configureR3().then(function() {
window.R3_ERROR = new r3_error();
rr_flush_onload();
r3();
});
} catch (error) {
console.error('GTM -> RR Error Page -> error', error);
}
@guilhermemarconi
guilhermemarconi / reset.css
Created June 30, 2022 22:48 — forked from EllyLoel/reset.css
CSS Reset
/*
Made by Elly Loel - https://ellyloel.com/
With inspiration from:
- Josh W Comeau - https://courses.joshwcomeau.com/css-for-js/treasure-trove/010-global-styles/
- Andy Bell - https://piccalil.li/blog/a-modern-css-reset/
- Adam Argyle - https://unpkg.com/[email protected]/normalize.min.css / https://codepen.io/argyleink/pen/KKvRORE
Notes:
- `:where()` is used to lower specificity for easy overriding.
*/