Skip to content

Instantly share code, notes, and snippets.

@pan227
pan227 / System Design.md
Created November 22, 2021 01:20 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@pan227
pan227 / UndoStack.js
Created September 23, 2021 17:15 — forked from dsamarin/UndoStack.js
Easy undo-redo in JavaScript.
function UndoItem (perform, data) {
this.perform = perform;
this.data = data;
}
/**
* UndoStack:
* Easy undo-redo in JavaScript.
**/
Fetcher interface:
fetchAnimals(prefix: string, callback: function): void
fetchArticles(prefix: string, callback: function): void
fetchFruits(prefix: string, callback: function): void
Note: there are many more fetchers
Callback interface:
callback(results: string[]): void
*/
fetchAnimals('g', (results) => console.log(results));
@pan227
pan227 / dom.html
Created May 6, 2021 05:58 — forked from victorouse/dom.html
Facebook Interview: Given two identical DOM tree structures, A and B, and a node from A, find the corresponding node in B
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Facebook DOM Traversal</title>
</head>
<body>
<div id="rootA">
<div>