Skip to content

Instantly share code, notes, and snippets.

// Enhanced Screaming Frog Recipe: Semantic Chunking + Open Source Embeddings
//
// This script breaks webpage content into semantic passages (paragraphs, headings,
// list items, etc.) and embeds each chunk using sentence-transformers/all-MiniLM-L6-v2,
// a high-performing open-source model that ranks well on MTEB benchmarks.
//
// SETUP REQUIRED:
// 1. Get a free Hugging Face token from: https://huggingface.co/settings/tokens
// 2. Replace 'your_hf_token_here' below with your actual token
// 3. The token will be stored in your SEO Spider configuration - be mindful when sharing
@sterlingsky
sterlingsky / gist:a0578ca6b19366cae509a03e3ab87dee
Created January 9, 2024 00:25
Build a grid of lat long points to feed into a rank tracker
const {Client} = require('@googlemaps/google-maps-services-js');
const geolib = require('geolib');
const client = new Client({});
async function isWater(latitude, longitude, apiKey) {
try {
const response = await client.reverseGeocode({
params: {
latlng: [latitude, longitude],
key: apiKey,
@sterlingsky
sterlingsky / gist:e8dbb8f7d4770f34be9f448a9d25b991
Created January 3, 2024 15:09
Code for sending Kinect events to GA4
<script>
// Replace 'https://trusted-origin.com' with the
// actual origin you expect to receive messages from.
// no trailing slash is needed
var trustedOrigin = ['https://trusted-origin.com','https://storage.googleapis.com'];
window.addEventListener('message', function(event) {
console.log(event)
if (trustedOrigin.indexOf(event.origin) > -1) {
var messageType = event.data && event.data.type;
@sterlingsky
sterlingsky / GBP Location Grabber
Last active November 1, 2023 15:36
Location Grabber Chrome Bookmarklet
javascript: (function (){let arr = document.querySelectorAll("tbody .uVccjd.n2Hdyf.r2A6yd.i9xfbb.N2RpBe[aria-checked='true']");console.log(arr);let output = [];for (let i = 0; i < arr.length; i++){ let item = arr[i]; let href2 = item.closest('tr[class*=w0Oumf]').querySelector('a.DuDIZe').href ; console.log(i, " - ", href2); let locationIn = href2.split('/'); let location = locationIn[4]; output.push(location); }let output1 = output.join("\n"); navigator.clipboard.writeText(output1);})();