Skip to content

Instantly share code, notes, and snippets.

@Pito1992
Pito1992 / index.js
Last active January 11, 2023 14:35
Employee Importance
test_employees_1 = [[1,5,[2,3]],[2,3,[]],[3,3,[]]]; // id = 1 11
test_employees_2 = [[1,7,[2,3]],[2,1,[]],[3,2,[4]],[4,3,[]]]; // id = 1
test_employees_3 = [[1,2,[5]],[5,-3,[]]]; // id = 5 -3
test_employees_4 = [[1,10,[2,3,4]],[2,-1,[]],[3,-2,[]],[4,-3,[]]]; // id = 3 -2
function mapEmployeesToObj(arrEmployees) {
const employeeObj = arrEmployees.reduce((acc, item) => {
const id = item[0];
const value = item?.[1] ?? 0;
@Pito1992
Pito1992 / dom_performance_reflow_repaint.md
Created September 23, 2022 09:11 — forked from faressoft/dom_performance_reflow_repaint.md
DOM Performance (Reflow & Repaint) (Summary)

DOM Performance

Rendering

  • How the browser renders the document
    • Receives the data (bytes) from the server.
    • Parses and converts into tokens (<, TagName, Attribute, AttributeValue, >).
    • Turns tokens into nodes.
    • Turns nodes into the DOM tree.
  • Builds CSSOM tree from the css rules.
@Pito1992
Pito1992 / multiple_ssh_setting.md
Created November 15, 2020 18:22 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "[email protected]"
@Pito1992
Pito1992 / javascript_deep_dive.md
Created November 15, 2020 17:57 — forked from romainl/javascript_deep_dive.md
JavaScript Deep Dive to Crack The JavaScript Interviews
const scheduled = [[10, 5], [25, 15]];
const newPrograms = [[18, 7], [12, 10]];
const checkOverlap = () => {
const result = newPrograms.map((program, index) => {
let overlaped = false
const scheduledLength = scheduled.length
const [startTimeNew, execTimeNew] = program
const endTimeNewProgram = startTimeNew + execTimeNew
let count = 0