Skip to content

Instantly share code, notes, and snippets.

View InKolev's full-sized avatar

Ivan Kolev InKolev

  • Bulgaria
View GitHub Profile
@InKolev
InKolev / Latencies.txt
Last active February 3, 2017 17:02 — 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 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

Unit testing - Brief overview

The definition of a unit test (by Roy Osherove)

Prerequisites

A unit of work is the sum of actions that take place between the invocation of a public method in the system and a single noticeable end result by a test of that system. A noticeable end result can be observed without looking at the internal state of the system and only through its public APIs and behavior. An end result is any of the following:

  • The invoked public method returns a value (a function that’s not void).
  • There’s a noticeable change to the state or behavior of the system before and after invocation that can be determined without interrogating private state.
  • There’s a callout to a third-party system over which the test has no control, and that third-party system doesn’t return any value, or any return value from that system is ignored. (Example: calling a third-party logging system that was not written by you and you don’t have the source to.)
// Place your settings in this file to overwrite default and user settings.
{
"terminal.external.windowsExec": "git-bash",
"eslint.enable": true,
"eslint.options": {
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "es6",
"env": {
"es6": true
$(function () {
// TODO: expand
const filetypeMap = {
'javascript': 'js',
'haskell': 'hs'
};
const $fetchBtn = $('#fetch-btn'),
$container = $('#paste-details');
@InKolev
InKolev / 0_reuse_code.js
Last active August 29, 2015 14:24
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console