https://jsperf.com/array-includes-and-find-methods-vs-set-has
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A snippet that describe the problem | |
* | |
* @link http://stackoverflow.com/questions/31538240/intellij-idea-wrong-find-usages-behavior-for-javascript-object-properties | |
*/ | |
function testFindUsagesInIDEA(element) { | |
'use strict'; | |
var object1 = { | |
canvas: d3.select('#canvas-test') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
attrs | |
baryosef | |
bbox | |
brushend | |
brushstart | |
dragend | |
dragstart | |
endinject | |
github | |
gulpif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>MutationObserver Table</title> | |
<style id="jsbin-css"> | |
html, body { | |
padding:0; |
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.
elem.offsetLeft
,elem.offsetTop
,elem.offsetWidth
,elem.offsetHeight
,elem.offsetParent
elem.clientLeft
,elem.clientTop
,elem.clientWidth
,elem.clientHeight
elem.getClientRects()
,elem.getBoundingClientRect()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
['--','-+','+-','++'] | |
.map( ([sign1,sign2]) => ['-','+'].map( op => `${sign1}Infinity ${op} ${sign2}Infinity`)) | |
.reduce( (perms, next) => [...perms, ...next], []) | |
.map( perm => `${perm} = ${eval(perm)}`) | |
.join('\n') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var _players = ['a', 'b', 'c', 'd', 'e', 'f', 'g']; | |
function generateTournament(players){ | |
players = [...players]; | |
if(players.length % 2 !== 0){ | |
players.push('Bye'); | |
} | |
// fill the tournament with empty arrays, every array holds the games for the same cycle |