Skip to content

Instantly share code, notes, and snippets.

View AdSegura's full-sized avatar

Adolfo Segura AdSegura

View GitHub Profile
@AdSegura
AdSegura / boss.js
Last active October 24, 2019 18:08
Nodejs workers as writeable stream
'use strict';
/**
* Nodejs Stream Workers example
* will cipher and return deciphered file.txt to console output
* using a worker as a writeable stream.
*
* Use:
* node boss.js < file.txt
*
* if node < 12
@kottenator
kottenator / simple-pagination.js
Created July 13, 2015 20:44
Simple pagination algorithm
// Implementation in ES6
function pagination(c, m) {
var current = c,
last = m,
delta = 2,
left = current - delta,
right = current + delta + 1,
range = [],
rangeWithDots = [],
l;