Skip to main content

Posts

Showing posts from May, 2025

JavaScript: Select Content and Copy to Clipboard (Snippet)

ℹ️ For Any Element Applicable for input and textarea elements. Also general DOM elements: div p blockquote span strong em Et cetera. 🧑‍💻 Snippet /** * Copies the text content of a DOM element to the clipboard using the Clipboard API. * * Supports input, textarea, and general DOM elements (e.g., div, span). * * @param {HTMLElement} elm - The element whose content will be copied. * @throws {Error} If the argument is not an HTML element. * @throws {Error} If the Clipboard API is unavailable. * @returns {Promise<void>} Resolves when content is copied successfully. * * @example * const input = document.querySelector('input'); * await copyToClipboard(input); * * const div = document.getElementById('textContent'); * await copyToClipboard(div); */ async function copyToClipboard(elm) { const isElement = elm instanceof HTMLElement; if (!isElement) { throw new Error(`${elm} is not a DOM...

Bagatha Bagpipe 🎻

One night at a pub, in a place where the pub is constructed, Tadhg O'MacMick is inside the pub. " One of your finest peanut! ", he shouted to the barman. The barman, being 20 cm from Tadhg O'MacMick, ignores him. Aside from the fact that he is precisely 20 centimetre from Tadhg O'MacMick. It's pretty near, mind you. For instance, watching a car muffler from 20 cm distance, pretty near. Or, placing our face 20 cm in front of a fireplace, pretty near. I made a point. Shortly after, he brings a bowl of peanuts to him. The "he" is Tadhg O'MacMick himself. Thus, he did, what we call, a self-service. " Oi, where did you get those peanuts? ", barked the barman in front of Tadhg O'MacMick's outward manifestation. (Tadhg O'MacMick) " Feck! You spat on my peanuts! I took them. " (Barman) " You brought your own bowl? " (Tadhg O'MacMick) " What bowl? " (Munching peanuts.) ...

Oedema

Hi. This post is from my own experience and my intense stare at the subject. Because if it were other people's experience or intense stare, I wouldn't know. Etymology Greek ΟΙΔΗΜΑ (OIDÄ’MA), meaning "swelling" (noun). From ΟΙΔΕΩ (OIDEÅŒ) = "to swell" (verb). ⬇️ Roman (Classical Latin) ➡️ OEDEMA . Taken directly from Greek. ⬇️ Medieval Latin ➡️ Å’DEMA . Typographic ligature of "oe" emerged (and other "variative pointers"), started from 8th century (manuscripts from the Carolingian period) and more common in printed Latin texts in the 15th–18th century. ⬇️ English (British): oedema . Directly from Latin's term. English (American): edema . ΟΙΔΗΜΑ ➡️ OEDEMA ➡️ oedema (or edema). Medical Definition 💡 Oedema is fluid retention — typically affecting the legs, feet, or hands — resulting in visible swelling. ✅ Common Cause In this era of "s...

JavaScript: Recursively Retrieve All Nested DOM Elements (Snippet)

Hi. 🙂 Let's name the function as crawlElements . /** * Recursively collects all nested element nodes from * a given DOM node. * * @param {Node} node - The root DOM node from which * to begin the search. * @returns {Element[]} An array of all descendant * element nodes found beneath * the input node. * * @example * const root = document.getElementById("container"); * const allElements = crawlElements(root); * console.log(allElements); // Array of nested div, span, etc. */ function crawlElements(node) { let elements = []; const isElement = node && node instanceof Element; const hasChildren = isElement && node.hasChildNodes(); if (!hasChildren) return elements; node.childNodes.forEach((child) => { if (child.nodeType === Node.ELEMENT_NODE) { elements.push(child); elements = [...elements, ...crawlElements(child)]; ...

World Domination: The Villain's Handbook (Skeletor)

Hi, there. 👋 After watching He-Man for more than 10 episodes, I sensed something awkward. 🤔 Skeletor with his might and schemes, as a fulltime villain, could not defeat He-Man, the freelance superhero — an unbeatable response squad. The less-clothed, tan, deeper and reverb-enhanced voice Prince Adam — is an instant comedy. And! When we apply that to a real-life situation: background music starts, the shouting begins, lift a sword while still chanting dramatically, thunder appears, transformed into a less-clothed, more tanned man, pointing the sword to a cat, the cat becomes bigger and more vicious, WITH SADDLE, somehow our timbre gets deeper with more reverb, then off we go performing the duty as He-Man. Unfathomably brilliant, that. Did you notice "he" is a pronoun used to refer to a male? Also, "man". So many gems. Let us see from the overall perspective. Suppose Skeletor won ...

Music: Amazing Grace

Please Enable JavaScript. One verse of Amazing Grace on electric piano. To echo John Newton. 4 August 1725 – 21 December 1807 A quiet rendition by Jp performed through Cakewalk . The rendition above is performed in the key of A — A Major scale (three sharps scale, do = A). Amazing Grace is commonly performed in G Major scale (one sharp scale, do = G). Audio is licensed under CC0 (Public Domain — no restriction) . About Amazing Grace 📜 John Newton wrote the lyrics (hymn). It wasn't metaphor — it was fact. He wrote his hymns in 1772 — after his soul heard and felt — Hey. First published in February 1779 as Olney Hymns — curated work of John Newton and his poet friend, William Cowper (1731–1800). Page 53 in Olney Hymns, the verses that would become known as "Amazing Grace". Amazing Grace lyrics is taken from Hymn XLI (41) verses — page 53 and 54 — of Olney Hymns. Olney is a historic market town i...
Monkey Raptor uses cookies for analytics, advertisements, and functionality. More info on Privacy Policy