Skip to content

Instantly share code, notes, and snippets.

View jatintiwari's full-sized avatar
🎯
Focusing

Jatin jatintiwari

🎯
Focusing
View GitHub Profile
@jatintiwari
jatintiwari / System Design.md
Created December 24, 2024 02:10 — 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?
@jatintiwari
jatintiwari / latency.txt
Created June 24, 2022 03:10 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 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
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
function TaskRunner(concurrency) {
this.concurrency = concurrency;
this.currentTasksRunning = 1;
this.tasks = [];
}
TaskRunner.prototype.executor = function () {
//0 [];
//1 [];
//2 [];
@jatintiwari
jatintiwari / README.md
Created March 29, 2021 14:05 — forked from KarlPurk/README.md
Appium with Vagrant
  1. Place android.rules, Vagrantfile and bootstrap.sh in a new directory.
  2. cd to the directory you created
  3. Call vagrant up
  4. Follow instructions after bootstrap script finishes.
@jatintiwari
jatintiwari / 00.install-android-sdk.sh
Created March 18, 2021 11:40 — forked from nhtua/00.install-android-sdk.sh
Run a Headless Android Device on Ubuntu server (no GUI)
#!/bin/bash -i
#using shebang with -i to enable interactive mode (auto load .bashrc)
set -e #stop immediately if any error happens
# Install Open SDK
apt update
apt install openjdk-8-jdk -y
update-java-alternatives --set java-1.8.0-openjdk-amd64
java -version
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Stars</title>
<style>
.one {
display: flex;
@jatintiwari
jatintiwari / extensions.json
Created October 2, 2019 17:11
.vscode/extensions.json
{
// See http://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
"recommendations": [
"visualstudioexptteam.vscodeintellicode",
"esbenp.prettier-vscode",
"ms-vscode.vscode-typescript-tslint-plugin",
"ms-azuretools.vscode-docker",
"editorconfig.editorconfig"
],
"unwantedRecommendations": [
/**
* jQuery 2.1.3's parseHTML (without scripts options).
* Unlike jQuery, this returns a DocumentFragment, which is more convenient to insert into DOM.
* MIT license.
*
* If you only support Edge 13+ then try this:
function parseHTML(html, context) {
var t = (context || document).createElement('template');
t.innerHTML = html;
return t.content.cloneNode(true);
@jatintiwari
jatintiwari / static_props.js
Created November 28, 2018 10:49
Static Properties in JavaScript Classes with Inheritance
// http://pop.frontendweekly.co/5i5tEf?utm_campaign=Frontend%2BWeekly&utm_medium=email&utm_source=Frontend_Weekly_126
class Base {
static get foo() {
return this._foo;
}
static set foo(foo) {
this._foo = foo;
}
}
var pullrefresh = {
/*++++++++++++++ 初始化 +++++++++++++*/
init: function (data) {
var self = this;
this.generatedCount = 0;
document.addEventListener('DOMContentLoaded', function () {
setTimeout(function () {