Skip to content

Instantly share code, notes, and snippets.

View exodus4d's full-sized avatar

Mark Friedrich exodus4d

View GitHub Profile
@exodus4d
exodus4d / nginx.conf
Last active January 2, 2020 04:28
nginx.conf for Pathfinder (Nginx v1.11.8)
# nginx Configuration File
# http://wiki.nginx.org/Configuration
# Run as a less privileged user for security reasons.
user nginx nginx;
# How many worker threads to run;
# "auto" sets it to the number of CPU cores available in the system, and
# offers the best performance. Don't set it higher than the number of CPU
# cores if changing this parameter.
@exodus4d
exodus4d / pathfinder.conf
Last active August 27, 2020 03:33
pathfinder.conf for Pathfinder (Nginx v1.11.8)
# www to non-www redirect -- duplicate content is BAD:
# https://github.com/h5bp/html5-boilerplate/blob/5370479476dceae7cc3ea105946536d6bc0ee468/.htaccess#L362
# Choose between www and non-www, listen on the *wrong* one and redirect to
# the right one -- http://wiki.nginx.org/Pitfalls#Server_Name
# rewrite to HTTPS
server {
listen 80;
listen [::]:80;
@exodus4d
exodus4d / morris.esm.js
Last active February 6, 2021 15:27
Morris.js - ES6 Module - Example
import Raphael from 'raphael';
var Morris, compStyle, minutesSpecHelper, secondsSpecHelper,
__slice = [].slice,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
Morris /* = window.Morris*/ = {};

Add more features [advanced]

At some point you might get limited by the Queue class as a data-structure. You have to add methods for new features, that break the definition of a Queue.

  • Multi threaded dequeue(): Maybe you want to break the limit of "one request after the other". E.g. run up to max 5 tasks parallel. You can replace this._pendingPromise (true|false) flag with a counter and check insinside dequeue().

async dequeue() {