Skip to content

Instantly share code, notes, and snippets.

@paulirish
paulirish / what-forces-layout.md
Last active May 16, 2024 19:29
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
@ericelliott
ericelliott / essential-javascript-links.md
Last active May 17, 2024 03:38
Essential JavaScript Links
@robertmarsal
robertmarsal / gist:9feaa9150926efa4175a
Created December 17, 2014 21:09
Install f.lux on Ubuntu 14.10
sudo apt-get install python-glade2 python-appindicator
git clone https://github.com/Kilian/f.lux-indicator-applet.git
cd f.lux-indicator-applet
chmod +x setup.py
sudo ./setup.py install
fluxgui
@joelhooks
joelhooks / dispatcher.js
Last active December 14, 2015 20:59
This is a port of a port. Very basic finite state machine. Requires underscore.
//this is an event dispatcher at its bare minimum.
var EventDispatcher;
(function () {
"use strict";
/**
* Minimal event dispatcher
* @see http://stackoverflow.com/q/7026709/87002
* @constructor
*/
@Nutrox
Nutrox / Oscillator.as
Created December 11, 2010 16:38
AS3 Oscillator Class
package nx.audio {
/**
*/
public class Oscillator implements ISampleGenerator {
private static const WAVEFORM_PULSE:uint = Waveform.PULSE;
private static const WAVEFORM_SAWTOOTH:uint = Waveform.SAWTOOTH;
private static const WAVEFORM_SINE:uint = Waveform.SINE;
private static const WAVEFORM_TRIANGLE:uint = Waveform.TRIANGLE;