Skip to content

Instantly share code, notes, and snippets.

Freelancing – Open to exciting opportunities

Ashish Singh git-ashish

Freelancing – Open to exciting opportunities
View GitHub Profile
veltman /
Last active Jul 21, 2021
Flocking boids
mrcslws / .block
Last active May 7, 2019 — forked from mbostock/.block
Pan & Zoom Axes
View .block
license: gpl-3.0
pbeshai / .block
Last active Aug 4, 2020
Animate thousands of points with canvas and D3
View .block
license: mit
height: 620
border: no
emeeks /
Last active Jun 6, 2019
Network Annotation with Collision Detection

Using collision detection with network visualization labels

This demonstrates how to use d3-annotation() with bboxCollide to procedurally place node labels. After using the nodes data to create a network visualization of the Les Miserables play, we filter the nodes to leave out the side characters and pass that array to d3-annotation. We then create a second forceSimulation, this time using the size of the notes as the property in our bounding box collision detection, to move the labels out of each others' way.

d3-annotation by Susie Lu.

steveharoz / .block
Last active May 5, 2021 — forked from mbostock/.block
d3-force testing ground
View .block
license: gpl-3.0
height: 1030
scrolling: yes
yurivish / venn-diagrams.js
Last active Dec 26, 2020
Area-proportional Venn Diagrams
View venn-diagrams.js
// Since `overlapArea` function is monotonic increasing, we can perform a
// simple bisection search to find the distance that leads to an overlap
// area within epsilon of the desired overlap.
function distanceForOverlapArea(r1, r2, desiredOverlap) {
// Ensure r1 <= r2
if (r1 > r2) {
var temp = r2;
r2 = r1;
r1 = temp;
drzax / .block
Last active Feb 12, 2021
Narrative Charts
View .block
license: mit
scrolling: true
height: 300
View .block
license: gpl-3.0
height: 960
mbostock / .block
Last active Jul 5, 2019
Line with Missing Data
View .block
license: gpl-3.0
paulirish /
Last active Jul 27, 2021
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