Skip to content

Instantly share code, notes, and snippets.

View guilhermemarconi's full-sized avatar

Guilherme Marconi guilhermemarconi

View GitHub Profile
@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.
*/
@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 / 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);
/**
* 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 / 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
}
});
function gco
git checkout $argv
end
function gb
git branch $argv
end
function gcm
git checkout master
end
function gcd
@guilhermemarconi
guilhermemarconi / .zshconfig
Last active August 28, 2019 21:18
Oh-My-ZSH configuration file
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/home/marconi/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
@guilhermemarconi
guilhermemarconi / deleteAddress.js
Last active June 20, 2024 02:11
Deal with User Profile and User Addresses in VTEX
fetch(`/no-cache/postalcode/address/delete/${addressName}`, {
credentials: 'same-origin',
})
.then(res => res.json())
.then(addressData => {
// ...
})
//marketingData Example
//vtexjs.checkout.orderForm.marketingData
import { getCookie } from 'path/to/cookies.js'
utms = {
utmCampaign: (getCookie('IPS') && ~getCookie('IPS').indexOf('Campanha') ? getCookie('IPS').split('Campanha=')[1].split('&')[0] : ""),
utmMedium: (getCookie('IPS') && ~getCookie('IPS').indexOf('Midia') ? getCookie('IPS').split('Midia=')[1].split('&')[0] : ""),
utmSource: (getCookie('IPS') && ~getCookie('IPS').indexOf('Parceiro') ? getCookie('IPS').split('Parceiro=')[1].split('&')[0] : ""),
utmiCampaign: (getCookie('ISICI') && ~getCookie('ISICI').indexOf('InternalCampaign') ? getCookie('ISICI').split('InternalCampaign=')[1].split('&')[0] : ""),
utmiPart: (getCookie('ISICI') && ~getCookie('ISICI').indexOf('InternalPart') ? getCookie('ISICI').split('InternalPart=')[1].split('&')[0] : "")
@guilhermemarconi
guilhermemarconi / gist:b20b835d552ccaf63f8d0127f0f283d3
Last active January 4, 2019 20:43
Endpoint para buscar, externamente, os pedidos de um usuário específico na VTEX
/api/checkout/pub/orders/?customerEmail=${email}