Skip to content

Instantly share code, notes, and snippets.

@natzir
natzir / Pseudo-Element-Highlighter-Bookmarklet.js
Created September 25, 2023 08:18
Pseudo-Element Highlighter Bookmarklet
View Pseudo-Element-Highlighter-Bookmarklet.js
javascript:(function(){function injectStyle(){var style=document.createElement('style');style.type='text/css';style.innerHTML='*::before, *::after {background-color: rgba(255,0,0,0.3) !important;}';document.head.appendChild(style);}injectStyle();})();
@natzir
natzir / gist:fb7fdaef6655cef3da5424c7ef976eea
Created September 22, 2023 11:47
Internal Link Checker Bookmarklet
View gist:fb7fdaef6655cef3da5424c7ef976eea
javascript:void%20function(){javascript:(function(){function%20a(a,b){if(b.length){let%20c=100/b.length,d=b.map((a,b)=%3E`${a}%20${b*c}%25%20${b*c+c}%25`);a.style.backgroundImage=%22linear-gradient(to%20right,%20%22+d.join(%22,%20%22)+%22)%22,a.style.color=%22black%22}}function%20b(a){if(a.href%26%26a.href.includes(g)){let%20b=a.href;d(b).then(b=%3E{300%3C=b.status%26%26400%3Eb.status%3F(c(a,%22olive%22,%223XX%20Redirect%22),i.redirect++):400%3C=b.status%26%26500%3Eb.status%3F(c(a,%22silver%22,%224XX%20Client%20Error%22),i.clientError++):500%3C=b.status%26%26(c(a,%22aqua%22,%225XX%20Server%20Error%22),i.serverError++),e()})}}function%20c(b,c,d){let%20e=b.getAttribute(%22colors%22);e=e%3FJSON.parse(e):[],e.includes(c)||e.push(c),b.setAttribute(%22colors%22,JSON.stringify(e)),b.setAttribute(%22status%22,d),a(b,e)}function%20d(a){let%20b=3e4,c={status:null,document:null};return%20new%20Promise(d=%3E{let%20e=new%20XMLHttpRequest;e.onreadystatechange=function(){4==e.readyState%26%26(clearTimeout(b),200%3C=e.status
@natzir
natzir / getPercentDiff.js
Last active August 28, 2023 14:54
getPercentDiff.js
View getPercentDiff.js
javascript:(function()%7Bjavascript%3A(function()%20%7Bconsole.log(%22%5BSC%20Calculator%20by%20Natzir%20Turrado%20%2F%20%40natzir9%5D%22)%3Bfunction%20processTable()%20%7Bconst%20xpath%20%3D%20%22%2F%2Ftable%5B%40class%3D'i3WFpf'%5D%22%3Bconst%20tables%20%3D%20document.evaluate(xpath%2C%20document%2C%20null%2C%20XPathResult.ORDERED_NODE_SNAPSHOT_TYPE%2C%20null)%3Bfor%20(let%20i%20%3D%200%3B%20i%20%3C%20tables.snapshotLength%3B%20i%2B%2B)%20%7Bconst%20table%20%3D%20tables.snapshotItem(i)%3Bconst%20secondHeader%20%3D%20table.querySelector(%22tr%20%3E%20%3Anth-child(2)%22)%3Bif%20(secondHeader%20%26%26%20secondHeader.querySelector(%22br%22))%20%7BprocessTableElement(table)%3B%7D%7D%7Dfunction%20processTableElement(table)%20%7Blet%20rows%20%3D%20table.querySelectorAll(%22tr%22)%3Blet%20firstDataRow%20%3D%20rows%5B1%5D%3Bif%20(firstDataRow%20%26%26%20(firstDataRow.querySelector(%22%3Anth-child(4)%20%3E%20span%20%3E%20span%20%3E%20span%22)%20%7C%7C%20firstDataRow.querySelector(%22%3Anth-child(7)%20%3E%20span%20%3E
@natzir
natzir / crux-api-bulk.ipynb
Created July 4, 2023 09:10
CrUX-API-bulk.ipynb
View crux-api-bulk.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@natzir
natzir / crux-from-google-serp.ipynb
Last active July 2, 2023 09:54
crux-from-google-serp.ipynb
View crux-from-google-serp.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View getPAA.js
var depth = parseInt(prompt("Please enter the scraping depth (we recommend between 1 to 3):", "2"));
if(!Number.isInteger(depth) || depth < 1) {
alert("Invalid depth! Setting depth to default (2).");
depth = 2;
}
var count = 1;
async function start() {
@natzir
natzir / Sistrix-Export-Clusters.js
Created August 9, 2021 13:19
Bookmark to extract Sistrix keyword clusters
View Sistrix-Export-Clusters.js
javascript:(function(){output="<html><head><title>Sistrix Clusters by @Natzir9</title></head><body><button onclick=\"tableToExcel('sistrixTable','Sistrix Clusters')\">Export Sistrix Clusters</button><table%20id=\"sistrixTable\"><tr><th>Keyword</th><th>Count</th><th>Volume</th></tr>";var myValue=document.getElementById('sidebar').getElementsByClassName('value number');for(var i=0;i<myValue.length;i+=3){output=output+"<tr><td>"+myValue[i].innerText+"</td><td>"+myValue[i+1].innerText+"</td><td>"+Math.round(myValue[i+2].innerText)+"</td></tr>";};output+="</table>";with(window.open()){document.write(output);document.body.appendChild(document.createElement('script')).src='https://bl.ocks.org/insin/raw/1031969/tableToExcel.js';document.close();}})();
@natzir
natzir / google-api-indexing.ipynb
Created November 12, 2020 14:50
Google-API-Indexing.ipynb
View google-api-indexing.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@natzir
natzir / puppeteer-fetch-and-render.js
Last active August 25, 2023 23:44
Fetch and Render as Googlebot
View puppeteer-fetch-and-render.js
// This code allows you to render a page as Googlebot with puppeter (headless Chrome).
// It even renders elements with the lazy-load implemented through IntersectionObserver.
// Copy and paste it here: https://try-puppeteer.appspot.com/
const browser = await puppeteer.launch();
const page = await browser.newPage();
// Descriptors for other mobile devices: https://github.com/puppeteer/puppeteer/blob/main/src/common/DeviceDescriptors.ts
const mobile = {
name: 'Nexus 5X',
View seo-split-testing.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.