Skip to content

Instantly share code, notes, and snippets.

View garris's full-sized avatar

Garris garris

View GitHub Profile
@paulirish
paulirish / what-forces-layout.md
Last active November 19, 2024 01:01
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
@kurtbartholomew
kurtbartholomew / MoveToOpenLine.sublime-keymap
Last active August 29, 2015 14:15
Move Up/Down to next open line macro for Sublime
/* Move to the next open line up or down (made to emulate line empty line jumping in Vim/Emacs).
Open keybindings via Preferences -> Key Bindings - User and past in between the [] brackets. */
{
"keys": ["ctrl+up"],
"command": "move",
"args": {"by": "stops", "empty_line": true, "forward": false}
},
{
"keys": ["ctrl+down"],
"command": "move",
@staltz
staltz / introrx.md
Last active November 19, 2024 02:40
The introduction to Reactive Programming you've been missing
@omo
omo / handlebars.js
Created February 21, 2012 13:16
Handlebars.js AMD support
// src/amd/prologue.js
define(function() {
// lib/handlebars/base.js
/*jshint eqnull:true*/
var Handlebars = {};
Handlebars.VERSION = "1.0.beta.5";
@paulirish
paulirish / rAF.js
Last active November 11, 2024 03:20
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];