Skip to content

Instantly share code, notes, and snippets.

View iRouge's full-sized avatar

Benoit Favreault iRouge

  • Montréal
View GitHub Profile
@paulirish
paulirish / what-forces-layout.md
Last active July 17, 2024 00: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
@blech
blech / netflix-genre-crawl.py
Last active July 10, 2024 13:02
Fetch genre names from Netflix
#!/usr/bin/python
# TODO make range command line arguments
import sys, codecs
sys.stdout = codecs.getwriter('utf-8')(sys.stdout) # if your terminal can't do utf-8, well...
import time
import urllib2
import BeautifulSoup
@phloe
phloe / combine-layout.md
Last active July 27, 2020 07:23
combine-layout - float/inline-block layout technique

combine-layout

The following outlines a technique combining floating blocks and inline-blocks allowing for fairly interesting layouts without the need to use nested rows and avoids some problems when using pure floats.

The technique itself only uses three classnames:

  • combine-layout - defines the containing element.
  • break - starts a new row when in floating block context.
  • divide - starts off the inline-block context.