Skip to content

Instantly share code, notes, and snippets.

/*
const x = new LinkedList();
x.add('meme');
x.add('dream');
x.lastValue; // 'dream'
*/
class LinkedItem {
constructor(value, next) {
function tofrac(x0) {
let x = x0;
let a = Math.floor(x);
let [h, k, h1, k1] = [a, 1, 1, 0];
while (x - a > Number.EPSILON * k * k) {
x = 1 / (x - a);
a = Math.floor(x);
let [h2, k2] = [h1, k1];
[h1, k1] = [h, k];
[
{
"emoji": "angry",
"shortcuts": [
">:(",
">:-(",
">=(",
">=-("
]
},
function range(start, end) {
return Array(end - start + 1).fill().map((_, idx) => start + idx)
}
const IIN = [
{
ISSUING_NETWORK: "American Express",
IIN_RANGES: [34, 37],
ACTIVE: true,
LENGTH: [15],
const Stream = require('stream');
const https = require('https');
const http = require('http');
const URL = require('url');
/**
* Resumable stream via a Stream PassThrough
* @param {string|URL} url Input url
* @param {stream.Transform} [output=stream.PassThrough] Output stream
* @param {Object} [meta] Meta information to pass between stuff
function makeWorker() {
return new Worker(URL.createObjectURL(new Blob([
`onmessage = function(message) {
const data = message.data;
postMessage({ status: 1 });
postMessage({ result: eval.call(this, data.code), status: 2 });
}`], { type: 'text/javascript' })));
}
function timedEval(code, timeout = 1000) {

Keybase proof

I hereby claim:

  • I am devsnek on github.
  • I am snek (https://keybase.io/snek) on keybase.
  • I have a public key whose fingerprint is 24E8 BBD2 DA10 B312 CF16 4CA2 58CC E2A2 4E2D 41DC

To claim this, I am signing this object:

@devsnek
devsnek / example.js
Last active June 17, 2017 11:59
requireTypeHintedFile.js
function test(asd: number, b: number) -> number {
return asd + b;
}
function test2(x: string, y: string) -> boolean {
return true;
}
module.exports = { test, test2 };
class Backoff {
constructor(min = 500, max, jitter = true) {
this.min = min;
this.max = max !== null ? max : min * 10;
this.jitter = jitter;
this._current = min;
this._timeout = null;
this._fails = 0;
}
@devsnek
devsnek / package.json
Last active July 5, 2017 00:30
promise_util
{
"name": "promise_util",
"version": "1.3.0",
"main": "promise_util.js"
}