Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am thaisrobba on github.
* I am thaispagarme (https://keybase.io/thaispagarme) on keybase.
* I have a public key ASA4WQlESZ8WQKliucwJI6aVDYklClN6RfTf1MUz8YupRgo
To claim this, I am signing this object:
@ThaisRobba
ThaisRobba / what-forces-layout.md
Created March 29, 2018 21:02 — 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()
@ThaisRobba
ThaisRobba / index.html
Last active November 23, 2016 15:17 — forked from Spyryto/index.html
For loop vs For ... of benchmark (http://jsbench.github.io/#b8d20031108ec0b39f94e00061133d2e) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>For loop vs For ... of benchmark</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@ThaisRobba
ThaisRobba / gist:3210b2840a540debad47
Last active January 26, 2018 21:50
Tiny component & entities module
var componentsList = {};
function Component(name, func) {
componentsList[name] = func;
}
//Components are created like this:
Component('flying', function(o) {
o.flying = true;
});
<link rel="import" href="../components/polymer/polymer.html">
<polymer-element name="my-element">
<template>
<style>
#design_host {
position: absolute;
width: 100%;
height: 100%;
@ThaisRobba
ThaisRobba / Polynomial function
Created February 11, 2014 06:45
Polynomial function for Lua (outputs value based on a numbers table and an x value)
local sum = 0
function polynomial(t, x)
--t is a table, x is the x value
for i=1, #t do
sum = sum+t[#t -i+1]*x^(i-1) --Travels in reverse through the table
end
return print(sum) --prints the result
end