Skip to content

Instantly share code, notes, and snippets.

View feynon's full-sized avatar

Ankesh Bharti feynon

View GitHub Profile
@jboner
jboner / latency.txt
Last active July 15, 2024 21:27
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
@staltz
staltz / introrx.md
Last active July 15, 2024 15:43
The introduction to Reactive Programming you've been missing
@crizstian
crizstian / solid.js
Last active March 15, 2023 02:40
Code examples of SOLID principles for JavaScript
/*
Code examples from the article: S.O.L.I.D The first 5 priciples of Object Oriented Design with JavaScript
https://medium.com/@cramirez92/s-o-l-i-d-the-first-5-priciples-of-object-oriented-design-with-javascript-790f6ac9b9fa#.7uj4n7rsa
*/
const shapeInterface = (state) => ({
type: 'shapeInterface',
area: () => state.area(state)
})
@mpj
mpj / episode.js
Created January 15, 2017 21:14
Code from the "Dependency Injection Basics" episode of Fun Fun Function
const assert = require('assert')
function getAnimals(fetch, id) {
return fetch('http://api.animalfarmgame.com/animals/' + id)
.then(response => response.json())
.then(data => data.results[0])
}
describe('getAnimals', () => {
it('calls fetch with the correct url', () => {
@webframp
webframp / keybase.md
Created July 25, 2017 18:14
Signing git commits on github using keybase.io gpg key

Probably one of the easiest things you'll ever do with gpg

Install Keybase: https://keybase.io/download and Ensure the keybase cli is in your PATH

First get the public key

keybase pgp export | gpg --import

Next get the private key

@mpj
mpj / order-total.js
Created November 26, 2017 21:03
Code from Unit testing in JavaScript Part 3 - Test runners
function orderTotal(order) {
return order.items.reduce((prev, cur) => cur.price * (cur.quantity || 1) + prev, 0)
}
module.exports = orderTotal
@TheCureliestWalk
TheCureliestWalk / signed-gpg-github.md
Last active July 9, 2021 10:12
How to create GPG Signed key with Keybase on Github

Sign GPG Key on Github with Keybase

mrkdwn-pass

Set everything up

  • Linux Computer (Windows or MacOS is compatible but you need to install GIT manually)
  • You need to install Keybase, login or sign up one if you don't have.
  • Your basic skill with Git and Github:

You need to know that Linux are have a default software: gpg for sign the GPG key. but we are going to use Keybase instead.

@EndingCredits
EndingCredits / JSON.bnf
Last active July 6, 2024 15:16
Describing the JSON specification in psuedo-Backus-Naur Form
<json> ::= <primitive> | <container>
<primitive> ::= <number> | <string> | <boolean>
; Where:
; <number> is a valid real number expressed in one of a number of given formats
; <string> is a string of valid characters enclosed in quotes
; <boolean> is one of the literal strings 'true', 'false', or 'null' (unquoted)
<container> ::= <object> | <array>
<array> ::= '[' [ <json> *(', ' <json>) ] ']' ; A sequence of JSON values separated by commas
const roads = [
"Alice's House-Bob's House", "Alice's House-Cabin",
"Alice's House-Post Office", "Bob's House-Town Hall",
"Daria's House-Ernie's House", "Daria's House-Town Hall",
"Ernie's House-Grete's House", "Grete's House-Farm",
"Grete's House-Shop", "Marketplace-Farm",
"Marketplace-Post Office", "Marketplace-Shop",
"Marketplace-Town Hall", "Shop-Town Hall"
];
body footer nav::after {
content: " by Ankesh Bharti";
color: var(--accent-color);
font-size: 1em;
}
@import url('https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i,800,800i&display=swap&subset=latin-ext');
:root {
--accent-color: #0000ff;