Skip to content

Instantly share code, notes, and snippets.

View andresgallo's full-sized avatar

Andres Gallo andresgallo

View GitHub Profile
// Select all meta tags with property attribute starting with "og:"
const ogTags = document.querySelectorAll('meta[property^="og:"]');
ogTags.forEach(tag => {
const property = tag.getAttribute('property');
const content = tag.getAttribute('content');
console.log(`${property}: ${content}`);
});
document.body.childNodes.forEach(child => {
if (child.nodeName === '#text' && child.nodeValue === "fbq('trackCustom', 'Outbound_Click')") {
document.body.removeChild(child)
}
})
var elForm = document.querySelector('bsp-form[data-anchor] form')
var elUrl = new URL(elForm.action)
elUrl.searchParams.append('_someKey', 'clearCache')
elUrl.searchParams.append('_renderer', 'styleguide')
console.log('ELURL', elUrl)
fetch(elUrl, {
method: 'POST',
body: new FormData(elForm)
{
"_exampleOnly" : true,
"_template" : "/page/Page.hbs",
"_wrapper" : false,
"above" : [ ],
"actions" : [ ],
"aside" : [ ],
"backButton" : false,
"banner" : [ ],
"below" : [ ],
<div class="Form-wrapper" data-module {{#if inverseColors}} data-inverse-colors{{/if}}{{#or backgroundColor backgroundImage}} data-has-background {{/or}}{{#if backgroundImage}} data-has-bg-image{{/if}} style="--color-form-background: {{#with backgroundColor}}{{this}}{{else}}#C4EDEB{{/with}};{{#each backgroundImage}}{{#resize image "xl-4x3"}} background-image: url('{{src}}');{{/resize}} {{/each}}{{~#with formErrorMessagesColor}} --color-error-messages: {{this}};{{/with~}}">
<bsp-form class="Form" {{~#with formType}} data-form-type="{{this}}"{{~/with}}>
{{include "/link/AnchorLink.hbs" this}}
{{#with title}}<div class="Form-title">{{this}}</div>{{/with}}
{{#with description}}<div class="Form-description">{{this}}</div>{{/with}}
{{#if submissionSuccess}}
<div class="Form-submissionSuccess">
{{#if message}}
{
"_exampleOnly" : true,
"_template" : "/page/Page.hbs",
"_wrapper" : false,
"above" : [ ],
"aboveTheHeader" : [ {
"_template" : "/dfp/GoogleDfpAdModule.hbs",
"adIndex" : "33a27791-78fd-4fb9-bd99-3a4fbc5efd23",
"hideOnDesktop" : false,
"hideOnMobile" : false,
const ids = Array.from(document.querySelectorAll('[id]'))
.map(v => v.id)
.reduce((acc, v) => {
acc[v] = (acc[v] || 0) + 1;
return acc
}, {});
console.log(ids);
// To get a list of duplicate IDs:
.ContactUs-sectionNavigation .Navigation-items.flickity-enabled:focus,.ModulePage-sectionNavigation .Navigation-items.flickity-enabled:focus,.SearchResultsPage-sectionNavigation .Navigation-items.flickity-enabled:focus,.SectionPage-sectionNavigation .Navigation-items.flickity-enabled:focus,.TagPage-sectionNavigation .Navigation-items.flickity-enabled:focus,.plyr input[type=range]:focus,.plyr:focus,.plyr__controls button:focus,[data-icon]:focus,div:focus,header .ArticlePageFullLead-navigation .NavigationItem-dropdown:focus,header .ArticlePageSmallLead-navigation .NavigationItem-dropdown:focus,header .ArticlePageTextLead-navigation .NavigationItem-dropdown:focus,header .AuthorPage-navigation .NavigationItem-dropdown:focus,header .CareerPostingPage-navigation .NavigationItem-dropdown:focus,header .ContactUs-navigation .NavigationItem-dropdown:focus,header .EmployeePage-navigation .NavigationItem-dropdown:focus,header .ListiclePage-navigation .NavigationItem-dropdown:focus,header .ModulePage-navigation .Navigatio
// We often have a cookie utility to make handling of cookies the same
tp = window.tp || [];
tp.push(["setAid", SOME ID]);
tp.push(["setCookieDomain", COOKIE_DOMAIN]);
tp.push( [ "addHandler", "startCheckout", function () {
window.sessionStorage.setItem("noreload", "true")
}]);
<div class="Page-byline">
<div class="Page-authors">
{{#if authors}}
<span>{{~format "/page/Page" "authorBy"~}}</span>
{{#set authorsCount=(length authors)}}
{{~#each authors~}}
{{~#not (or @first @last)~}}
,&nbsp;
{{~else~}}