Skip to content

Instantly share code, notes, and snippets.

View svagi's full-sized avatar

Jan Šváger svagi

View GitHub Profile
@paulirish
paulirish / what-forces-layout.md
Last active June 13, 2024 11:17
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
var Col = require('react-bootstrap/lib/Col')
var PageHeader = require('react-bootstrap/lib/PageHeader')
var React = require('react')
var Row = require('react-bootstrap/lib/Row')
var {connect} = require('react-redux')
var {reduxForm} = require('redux-form')
var DateInput = require('./DateInput')
var FormField = require('./FormField')
var LoadingButton = require('./LoadingButton')
@danguita
danguita / docker-machine-ssh-tunneling.md
Last active June 26, 2020 16:43
Docker Machine SSH tunneling

As described on the Docker Machine SSH reference, the docker-machine CLI invokes the standard OpenSSH client so we can use the common SSH tunneling syntax here. The following command will forward port 3000 from the default machine to localhost on your host computer's loopback interface. Using 0.0.0.0 as bind_address will make it bind to all interfaces:

$ docker-machine ssh default -L 0.0.0.0:3000:localhost:3000

So, the container running at machine's port 3000 can be reached through localhost:3000 or any of your interfaces' IP (i.e. 192.168.1.10:3000). That'd be useful to access your containerized services from other devices in your LAN.

@danguita

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?