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.toLowerCase() | |
if (/kakaotalk/.test(userAgent)) { | |
location.href = | |
'kakaotalk://web/openExternal?url=' + encodeURIComponent(location.href) | |
setTimeout(() => { | |
location.href = /ipad|iphone|ipod/.test(userAgent) | |
? 'kakaoweb://closeBrowser' | |
: 'kakaotalk://inappbrowser/close' | |
}) |
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
// Copy-paste into your console (or minify and save as a bookmarklet) to see any DOM in an almost-sorta-working 3D stack of DOM elements. | |
// The front faces are colored for debugging, if this gist can be fixed, they can return to their normal styling. | |
(function () { | |
const MAX_ROTATION = 180; | |
const DEPTH_INCREMENT = 25; | |
const PERSPECTIVE = 1000; | |
const SIDE_FACE_CLASS = 'side-face'; | |
const MAX_DOM_DEPTH = getMaxDepth(document.body); | |
// Calculate color based on depth, ensuring lighter colors for deeper elements |
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
import puppeteer from 'puppeteer-extra'; | |
import pluginStealth from 'puppeteer-extra-plugin-stealth'; // Use v2.4.5 instead of latest | |
import * as readline from 'readline'; | |
puppeteer.use(pluginStealth()); | |
// Use '-h' arg for headful login. | |
const headless = !process.argv.includes('-h'); | |
// Prompt user for email and password. |
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
/** | |
* useScroll React custom hook | |
* Usage: | |
* const { scrollX, scrollY, scrollDirection } = useScroll(); | |
*/ | |
import { useState, useEffect } from "react"; | |
export function useScroll() { | |
const [lastScrollTop, setLastScrollTop] = useState(0); |