Skip to content

Instantly share code, notes, and snippets.

@episage
episage / fastest_for.js
Last active August 26, 2024 15:36 — forked from DungGramer/fastest_for.js
Find fastest way to loop through an array in Javascript
const { performance } = require('perf_hooks');
const assert = require('assert');
const DURATION_COLUMN = 'time[ns]';
// Create 1000 random numbers
const createTestArray = length => Array.from({ length }, () => 1 + Math.floor(Math.random() * 1000));
const createReferenceArray = testArray => testArray.map(v => Math.ceil((v + 2) / 10));
const sumUp = array => array.reduce((sum, value) => sum + value, 0);
const computeBenchmark = v => Math.ceil((v + 2) / 10);
@bvaughn
bvaughn / react-lifecycle-cheatsheet.md
Last active September 2, 2024 17:46
React lifecycle cheatsheet

React lifecycle cheatsheet

Method Side effects1 State updates2 Example uses
Mounting
componentWillMount Constructor equivalent for createClass
render Create and return element(s)
componentDidMount DOM manipulations, network requests, etc.
Updating
componentWillReceiveProps Update state based on changed props
@eyecatchup
eyecatchup / mr.robot_season-2_easter-egg-sites.md
Last active April 4, 2024 10:39
A collection of "Mr. Robot" Season 2 Easter Egg Sites. #mrrobot #hackingrobot #robotegg