Skip to content

Instantly share code, notes, and snippets.

View Yarov's full-sized avatar

Yarov Rivera Yarov

View GitHub Profile
@Yarov
Yarov / what-forces-layout.md
Created October 30, 2015 07:35 — forked from paulirish/what-forces-layout.md
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.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@Yarov
Yarov / digital_ocean_setup.md
Last active August 29, 2015 14:25 — forked from ChuckJHardy/digital_ocean_setup.md
DigitalOcean Ubuntu 14.04 x64 + Rails 4 + Nginx + Unicorn + PostgreSQL + Capistrano 3 Setup Instructions
var config = {
"menu":[],
"widget":[]
};
var setConfig =function(){
$.each($('[data-type]'), function(index, data){
if(data.dataset.type =="menu"){
$(data).find('ul li').each(function(index, data){
config.menu.push($(data).text());