This file contains hidden or 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
// This React component utilizes a useEffect hook to traverse up the DOM tree from a referenced element, | |
// identifying any parent elements with an overflow property that could interfere with the intended 'sticky' | |
// positioning of the element. It logs each parent's overflow status and highlights those that may cause issues. | |
// Useful in debugging layout issues related to 'sticky' positioned elements. | |
// | |
// Usage: | |
// Simply include this component within your React application. The referenced element is automatically checked | |
// on component mount. For non-React code, the logic within useEffect could be extracted and run after the DOM | |
// has fully loaded, using a direct DOM element reference instead of a ref. | |
// |
This file contains hidden or 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 | |
# -------------------------------------------------------------------------- | |
# Script Author: @joshcawthorne | |
# Warning: BACKUP ALL YOUR FILES BEFORE RUNNING THIS - THIS IS A DESTRUCTIVE | |
# OPERATION, I AM NOT RESPONSIBLE FOR ANY LOST FILES. | |
# OS Compatibility: MacOS, Linux, and WSL on Windows 10/11. | |
# -------------------------------------------------------------------------- | |
# Description: | |
# - |
This file contains hidden or 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 nullLink = null; | |
function isValidFullSlug(link) { | |
return typeof link == "string" && link[0] !== "/"; | |
} | |
function parseStoryblokLink(link) { | |
if (!parseStoryblokLink.isValidUrl(link)) { | |
return nullLink; | |
} |
This file contains hidden or 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
import { useState, useEffect } from "react"; | |
function useWindowSize() { | |
const [windowSize, setWindowSize] = useState<{ width: number | undefined; height: number | undefined }>({ | |
width: undefined, | |
height: undefined, | |
}); | |
useEffect(() => { | |
function handleResize() { |