Skip to content

Instantly share code, notes, and snippets.

@plugn
plugn / dumpVFS.js
Last active April 8, 2016 13:20
dump vinyl stream
var through = require('through2').obj;
/**
* tools
*/
function dumpVFS (stream) {
return stream.pipe(through(function(file, encoding, done) {
console.log(' * ', file.path); //, file.inspect(), file.contents.toString());
done(null, file);
}));
@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
@cmckni3
cmckni3 / get-event-listeners.js
Last active November 28, 2024 15:53
Get all event listeners on page
window.getAllEventListeners = () => {
return Array.from(document.querySelectorAll('*')).map(element => {
const listeners = getEventListeners(element);
return {
element: element,
listeners: Object.keys(listeners).map(key => {
return {
event: key,
@plugn
plugn / index.html
Last active March 10, 2017 13:10
float grid 3 col layout // source https://jsbin.com/veriva
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
.clearfix::after {
display: table;
content: "";
@plugn
plugn / zoom2bbox.js
Last active March 30, 2017 16:07
calcBbox(zoom) (with prefined bboxes)
function realMetrics () {
var bbox3 = {
lat: 64.68632,
lng: 97.74531,
nw_lat: 81.413933,
nw_lng: -25.3125,
se_lat: 22.43134,
se_lng: 220.429688
};
@plugn
plugn / index.html
Last active October 2, 2019 14:49
_.flow() example // source https://jsbin.com/yoheci
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src="https://code.jquery.com/jquery-3.1.0.js"></script>
<script src="http://cdn.jsdelivr.net/npm/[email protected]/lodash.min.js"></script>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
html, body {
height: 100%;
}
@OrenBochman
OrenBochman / Search my gists.md
Last active August 28, 2024 21:07 — forked from santisbon/Search my gists.md
How to search gists

Gist Search Cheatsheet

Enter this in the search box along with your search terms:

Get all gists from the user santisbon.
user:orenbochman

Find all gists with a .yml extension.
extension:yml

@plugn
plugn / InputPlus.vue
Last active November 23, 2018 17:09
Sexy Input for Semantic-UI
<template>
<div class="ui icon input">
<input
:placeholder="placeholder"
:value="value"
@input="onInput"
@blur="onBlur"
ref="input"
/><i
class="icon" :class="value ? 'close link' : icon"