Skip to content

Instantly share code, notes, and snippets.

@zzmp
zzmp / latency.txt
Last active September 11, 2015 05:01 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
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
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms
Read 4K randomly from SSD* 150,000 ns 0.15 ms
### Keybase proof
I hereby claim:
* I am zzmp on github.
* I am zmp (https://keybase.io/zmp) on keybase.
* I have a public key whose fingerprint is AF20 1653 C7D5 8AB0 3F14 D622 0352 EC88 AE09 42D8
To claim this, I am signing this object:
@zzmp
zzmp / Spellchecker.js
Last active August 29, 2015 14:11
Spellchecker
// This code is meant to accompany this [blog entry](http://www.garabagne.io/2014/12/15/spellchecker/).
// It was inspired primarily by [this article](http://www.norvig.com/spell-correct.html).
Spellchecker = function() {
/** A spellchecker.
* _Will suggest more common spellings of questionable words._
* @class Spellchecker
* @param {string} [text] - space-separated text, as from a book, to use for initial training
* @example
* // someText = 'hello world'
@zzmp
zzmp / repoUnwatcher.js
Last active August 25, 2019 17:04
Filter out your unwanted Watched repos
/* REPO UNWATCHER
*
* This unwatches any repo that you don't specify.
* It must be run from the console while you are at https://github.com/watching
*
* *No need to edit any code - the instructions will prompt you to list out the repos you'd like to keep watching!*
*/
var repo;
var repos = [];

No, they're not, but they might seem that way when you first meet them. Thanks to Hack Reactor, I no longer think of them that way. After a deep dive and some BackBone, you won't either. Here's what I'm going to cover:

  1. Why: What makes events so special
  2. How: How a basic event system works
  3. Backbone: A pitfall of the Event API
  • Bonus round: DOM Event API

If you're comfortable with eventing systems, you'll probably want to skip to section three.