Skip to content

Instantly share code, notes, and snippets.

@melloc01
melloc01 / what-forces-layout.md
Created October 14, 2021 18:00 — 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.

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
@melloc01
melloc01 / extensions.json
Created April 20, 2020 13:23
Settings sync: extensions.json
[
{
"metadata": {
"id": "d3836729-9cc1-42c1-b2af-d50071f57d29",
"publisherId": "formulahendry.auto-close-tag",
"publisherDisplayName": "formulahendry"
},
"name": "auto-close-tag",
"publisher": "formulahendry",
"version": "0.5.6"
@melloc01
melloc01 / Desafio Pokémon
Created January 17, 2020 14:20
Desafio Pokémon
Implementar um catálogo de Pokémons (Pokédex) utilizando a API http://pokeapi.co
----
A aplicação precisa:
- Listar pokémons (paginável)
- Ao clicar em um pokémon, exibir detalhes (livre)
Usar como parâmetro para estilização https://www.pokemon.com/us/pokedex/.
@melloc01
melloc01 / cloudSettings
Last active September 24, 2021 14:43
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-12-19T18:25:14.965Z","extensionVersion":"v3.2.4"}
@melloc01
melloc01 / cloudSettings
Created August 15, 2018 15:14
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-08-15T15:14:11.978Z","extensionVersion":"v3.0.0"}
@melloc01
melloc01 / cloudSettings
Created July 11, 2018 20:41
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-07-11T20:41:12.256Z","extensionVersion":"v2.9.2"}
'use strict'
Object.defineProperty(exports, '__esModule', {
value: true
})
var _createClass = (function () {
function defineProperties (target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i]
@melloc01
melloc01 / jest-async.js
Last active November 17, 2017 18:41
Testando método async numa flux store com jest
// no test
const subscriber = require('./subscriber') // automock
it('should test something', () => {
dispatch(dispatcher, BLIR_CONSTANT, null, { requestIndex: 2 })
console.log('esse aparece antes')
// no teste, esse subscriber é o mesmo (===) lá dentro do escopo do src
expect(subscriber.request.mock.calls).toHaveLength(1)
})
@melloc01
melloc01 / Install-php7.md
Created August 19, 2016 18:21 — forked from hollodotme/Install-php7.md
Installing php7-fpm with phpredis and xdebug extension on Ubuntu 14.04

Install php7.0-fpm

# remove php5 modules
apt-get autoremove --purge php5-*
# add php-7.0 source list by [Ondřej Surý](https://github.com/oerdnj)
add-apt-repository ppa:ondrej/php
# Update index
apt-get update
# Install php7.0-fpm with needed extensions
@melloc01
melloc01 / BindSocket.js
Created March 16, 2016 23:06
AngularJS Service
function BindSocketService($rootScope, io) {
function BindSocket(resource, items) {
var connection = io.socket.on(resource,function handle(evt) {
switch (evt.verb) {
case 'created':
items.push(evt.data);
$rootScope.$apply();
break;
case 'destroyed':
var index;