Skip to content

Instantly share code, notes, and snippets.

View halvards's full-sized avatar

Halvard Skogsrud halvards

  • Atlassian
  • 23:58 (UTC +10:00)
View GitHub Profile
@paulirish
paulirish / what-forces-layout.md
Last active July 4, 2025 06: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
@SamuelMarks
SamuelMarks / nodejs_phantomjs_render.js
Created July 26, 2013 04:37
Google AngularJS SEO talk from July, 2013
/* render website with JS and return its rendered output
Syntax: node nodejs_phantomjs_render.js [url] [output {default=stdout}] */
var system = require('system'),
fs = require('fs'),
page = new WebPage(),
url = system.args[1],
output = system.args[2],
result;
anonymous
anonymous / gist:3202101
Created July 29, 2012 22:06
Route DNS through unotelly for BBC Olympics coverage in Ubuntu 12.04
# Proxies like unotelly may send more of your traffic through their service than you would like. You can protect your traffic but still use the tunnel if you only send bbc.co.uk DNS lookups to unotelly.
# Here's how to do this in Ubuntu 12.04. The DNS has changed in 12.04 to use NetworkManager, which makes the process more convoluted than it should be. The below instructions could be improved but it'll get you some BBC Olympics coverage.
$ nslookup bbc.co.uk
# you should see a UK IP e.g. 212.58.241.131
$ vi /etc/NetworkManager/NetworkManager.conf
# comment out dnsmasq
#dns=dnsmasq