Skip to content

Instantly share code, notes, and snippets.

View JarrodMFlesch's full-sized avatar
👋

Jarrod Flesch JarrodMFlesch

👋
View GitHub Profile
@JarrodMFlesch
JarrodMFlesch / cpuprofile.cpuprofile
Created February 21, 2024 13:42
Profile for [NEXT-1143] issue
{"nodes":[{"id":1,"callFrame":{"functionName":"(root)","scriptId":"0","url":"","lineNumber":-1,"columnNumber":-1},"hitCount":0,"children":[2,29,305,459,462,691,692,709,713,721,805,809,836,843]},{"id":2,"callFrame":{"functionName":"","scriptId":"390","url":"node:internal/main/run_main_module","lineNumber":0,"columnNumber":0},"hitCount":0,"children":[3]},{"id":3,"callFrame":{"functionName":"executeUserEntryPoint","scriptId":"70","url":"node:internal/modules/run_main","lineNumber":119,"columnNumber":30},"hitCount":0,"children":[4]},{"id":4,"callFrame":{"functionName":"Module._load","scriptId":"62","url":"node:internal/modules/cjs/loader","lineNumber":939,"columnNumber":23},"hitCount":0,"children":[5]},{"id":5,"callFrame":{"functionName":"Module.load","scriptId":"62","url":"node:internal/modules/cjs/loader","lineNumber":1183,"columnNumber":32},"hitCount":0,"children":[6]},{"id":6,"callFrame":{"functionName":"Module._extensions..js","scriptId":"62","url":"node:internal/modules/cjs/loader","lineNumber":1368,"column
@JarrodMFlesch
JarrodMFlesch / segment-array.ts
Last active May 11, 2024 11:34
Segment Array
function segmentArray<T>(arrayToSegment: T[], segmentSize: number): T[][] {
const segmentedArray = arrayToSegment.reduce(
(segments, item) => {
const newSegments: any[] = [...segments]
if (newSegments[newSegments.length - 1].length === segmentSize) {
newSegments[newSegments.length] = [item]
} else {
newSegments[newSegments.length - 1].push(item)
}