Skip to content

Instantly share code, notes, and snippets.

View nivethan-me's full-sized avatar
🎯
Focusing on how to solve my problems using software

Nivethan nivethan-me

🎯
Focusing on how to solve my problems using software
View GitHub Profile
@williamyeny
williamyeny / wait-for-element.ts
Created December 14, 2022 00:02
Writen for a Chrome extension. It checks for a specific element on the page and calls a callback when it's found.
// Writen for a Chrome extension. It checks for a specific element on the page and calls a callback when it's found.
// Returns an element and all its child elements.
const getAllElements = (node: Node): Element[] => {
if (!(node instanceof Element)) {
return [];
}
const nodes = [node];
if (node.childNodes) {
nodes.push(...[...node.childNodes].flatMap(getAllElements));
@nivethan-me
nivethan-me / README.md
Last active July 13, 2024 06:05
Setup a Next.js 13 project with Eslint + Prettier with automatic tailwind class sorting