Skip to content

Instantly share code, notes, and snippets.

View Pakirava-Datsuma's full-sized avatar

Dmytro Kulieshov Pakirava-Datsuma

  • Ukraine
View GitHub Profile
@Pakirava-Datsuma
Pakirava-Datsuma / gist:e1bedebc3dbfa5c04442089e5fff74ee
Last active March 7, 2025 16:20
beep browser when a new DOM element appears
[
["li pre.log-line", "Error", 440],
["li pre.log-line", "Warning", 523]
].forEach(([selector, targetText, frequency]) => {
new MutationObserver(mutations =>
mutations.forEach(({ addedNodes }) =>
addedNodes.forEach(node => {
if (node.nodeType === 1 &&
(node.matches?.(selector) || node.querySelector?.(selector)) &&
node.textContent.includes(targetText)) {
@Pakirava-Datsuma
Pakirava-Datsuma / snippets.js
Last active February 1, 2024 14:20
JS snippets for browser console
// concat text across divs
Array.from(document.querySelectorAll("div.event-text span font font")).reduce((acc, el) => acc + `\
` + el.textContent, ' ')
// print unique commit authors
Array.from(new Set(
Array.from(document.querySelectorAll("a.commit-author"))
.map(a => '@'+a.textContent)
))
.reduce((acc, el) => acc + el + ' ', '')