Skip to content

Instantly share code, notes, and snippets.

View CEOehis's full-sized avatar
🏠
Working from home

Celestine Ekoh-Ordan CEOehis

🏠
Working from home
View GitHub Profile
@yoavniran
yoavniran / ultimate-ut-cheat-sheet.md
Last active May 16, 2024 13:16
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai, Sinon, and Jest
@rgrove
rgrove / getAbsoluteBoundingRect.js
Created April 25, 2013 21:20
Simple JS function that returns a bounding rect for an element with absolute coordinates corrected for scroll positions.
/**
Returns a bounding rect for _el_ with absolute coordinates corrected for
scroll positions.
The native `getBoundingClientRect()` returns coordinates for an element's
visual position relative to the top left of the viewport, so if the element
is part of a scrollable region that has been scrolled, its coordinates will
be different than if the region hadn't been scrolled.
This method corrects for scroll offsets all the way up the node tree, so the