This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const userAgent = navigator.userAgent; | |
const googleBotRegex = /Google/i; | |
if (googleBotRegex.test(userAgent)) { | |
const url = new URL(window.location.href); | |
url.searchParams.set('utm_source', 'googlebot'); | |
url.searchParams.set('utm_medium', 'crawler'); | |
url.searchParams.set('utm_campaign', 'bot_campaign'); | |
// Update the URL without reloading the page | |
window.history.replaceState(null, '', url.toString()); | |
console.log("UTM CHECK", url.toString()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function convertStringToSpaces(inputString) { | |
// List of space-like Unicode characters, excluding zero-width spaces for visual effect | |
const unicodeSpaces = [ | |
'\u0020', // Space | |
'\u00A0', // No-Break Space | |
'\u2002', // En Space | |
'\u2003', // Em Space | |
'\u2009', // Thin Space | |
'\u202F', // Narrow No-Break Space | |
'\u205F', // Medium Mathematical Space |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 inch trek bike size chart | |
2010 trek 2.1 alpha road bike | |
2010 trek 2.1 alpha road bike review | |
2011 trek fuel ex 8 seatpost diameter | |
2012 trek 2.1 alpha road bike | |
2012 trek fuel ex 8 seatpost diameter | |
2013 trek fuel ex 8 seatpost diameter | |
2014 trek fuel ex 7 rear shock | |
2014 trek fuel ex 7 weight | |
2015 trek crockett geometry |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function trackScrollDepth() { | |
const scrollPercentages = [25, 50, 75, 100]; | |
window.addEventListener('scroll', () => { | |
const scrollHeight = document.documentElement.scrollHeight - window.innerHeight; | |
const scrollPosition = window.scrollY; | |
const scrollRatio = (scrollPosition / scrollHeight) * 100; | |
if (scrollPercentages.includes(Math.floor(scrollRatio))) { | |
// Perform scroll depth tracking actions | |
console.log(`Scrolled to ${Math.floor(scrollRatio)}%`); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const validKeyNames = ['name', 'gender', 'hasTheForce'] | |
var a = { name: 'Luke Skywalker', gender: 'Male', hasTheForce: true } | |
var b = { name: 'James Brown', gender: 'Male', hasTheFunk: true } | |
function check(obj, arr) { | |
return Object.keys(obj).every(e => arr.includes(e)); | |
} | |
console.log(check(a, validKeyNames)) | |
console.log(check(b, validKeyNames)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const https = require('https'); | |
async function fetch(url) { | |
return new Promise(async (resolve, reject) => { | |
https.get(url, function (res) { | |
var body = ''; | |
res.on('data', function (chunk) { | |
body += chunk; | |
}); | |
res.on('end', function () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// via https://stackoverflow.com/a/39900099 | |
function listFonts () { | |
let fonts = [] | |
for (let node of document.querySelectorAll('*')) { | |
if (!node.style) continue | |
for (let pseudo of ['', ':before', ':after']) { | |
let fontFamily = getComputedStyle(node, pseudo).fontFamily | |
fonts = fonts.concat(fontFamily.split(/\n*,\n*/g)) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sort file | uniq > new_file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sort file1 file2 | uniq -c | awk '$1 == 1 {print $2}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ls -d */ |
NewerOlder