Skip to content

Instantly share code, notes, and snippets.

View danielpox's full-sized avatar

Daniel Hallgren danielpox

View GitHub Profile
@danielpox
danielpox / insert-alt-text.js
Created February 20, 2022 15:32
Append image alt text as paragraph after image
document.querySelectorAll('img[alt]:not([alt=""])')
.forEach(img => {
const alt = document.createElement('p')
alt.innerText = img.getAttribute('alt')
alt.className = 'image-alt-text'
img.after(alt)
})
@danielpox
danielpox / raised-hands.js
Created January 28, 2021 19:41
Sum raised hands/attendance in Zoom WebSDK Client
let sumVotes = () => Array.from(document.querySelector('.participants-ul').childNodes).filter(el => el.getAttribute('aria-label').includes('hand raised')).map(el => Number(el.getAttribute('aria-label').match(/\d+/)[0])).reduce((acc, curr) => acc + curr, 0)
@danielpox
danielpox / machine.js
Last active September 21, 2020 20:21
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@danielpox
danielpox / simaquarium_problem.cpp
Created November 2, 2018 03:15
SimAquarium Problem
/*
* Original problem with code
*/
/* Definition */
struct algae_position {
int x;
int y;
};