Skip to content

Instantly share code, notes, and snippets.

View macobo's full-sized avatar
🚀

Karl-Aksel Puulmann macobo

🚀
View GitHub Profile
@keithpitt
keithpitt / database_state_loader.rb
Last active June 6, 2025 19:31
Note that this code only works with PostgreSQL, but it wouldn’t be too hard to adapt our approach for other relational databases.
# Add to `spec/support/database_state_loader.rb`
class DatabaseStateLoader
class EnvironmentError < RuntimeError; end
def self.load(path)
new(path).load
end
def initialize(path)
@paulirish
paulirish / what-forces-layout.md
Last active March 24, 2026 19:51
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent