Skip to content

Instantly share code, notes, and snippets.

View exodus4d's full-sized avatar

Mark Friedrich exodus4d

View GitHub Profile
@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() {

@exodus4d
exodus4d / processJSON.php
Created February 17, 2019 13:20
reactphp NDJSON client decoder
<?php
// NDJSON Ping/Pong communication:
// 1. Client send ONE JSON object
// 2. Server respond with ONE JSON obect
// 3. Client MIGHT send another JSON object
// 4. Server WOULD respond with OND JSON object
// 5. ....
// Questions:
// [1] I use first() in combination with once(), because a data chunk MIGHT contain multiple NDJSON objects
// 2nd, 3rd object should be ignored... Is this a good practice?
@exodus4d
exodus4d / winnmp.log
Last active November 5, 2018 19:42
winnmp.log
Terminating 80
Terminating ALL processes..
Terminating 6379
Terminating 9002
Terminating 9003
@exodus4d
exodus4d / index.php
Last active September 9, 2018 13:16
Pathfinder HTTP2 ServerPush
<?php
abstract class Controller {
function beforeroute(\Base $f3, $params): bool {
if( !$f3->get('AJAX') ){
// singleton Resource() handels serverPush for static resources
$resource = Resource::instance();
$resource->setOption('filePath', [
'style' => $f3->get('BASE') . '/public/css/' . Config::getPathfinderData('version'),
'script' => $f3->get('BASE') . '/public/js/' . Config::getPathfinderData('version'),
'font' => $f3->get('BASE') . '/public/fonts',
@exodus4d
exodus4d / PHP-FPM-respawn-issue.md
Last active January 6, 2018 16:56
Hallo Stefan L. :)

Ich habe den Fehler für das ständige restarten gefunden!

1. In der /etc/php-fpm.conf steht, dass ein PHP-FPM process neu gestartet wird bei 3 errors innherhalb von 1 Minute:
  • emergency_restart_threshold = 3
  • emergency_restart_interval = 1m

Als "Error" wird alles angesehen was sich in der /var/log/php-fpm/error.log findet mit prefix ERROR oder WARNING, das lässt sich über log_level = error anpassen, so dass nur noch `ERROR´ geloggt werden. Ansonsten werden auch solche standard Einträge als Error gelöscht:

[05-Jan-2018 21:04:17] WARNING: [pool www] server reached pm.max_children setting (28), consider raising it
@exodus4d
exodus4d / second_map_2016_07_31.json
Created July 31, 2016 23:00
Pathfinder example map export JSON file
{
"config" : {
"id" : 2,
"name" : "second map",
"icon" : "fa-desktop",
"created" : 1469912015,
"updated" : 1469912085,
"scope" : {
"id" : 1,
"name" : "wh",
fastcgi_param PF-ENV-BASE '';
fastcgi_param PF-ENV-URL $scheme://$host;
fastcgi_param PF-ENV-DEBUG 3;
fastcgi_param PF-ENV-CACHE 'redis=localhost:6379';
fastcgi_param PF-ENV-DB_DNS 'mysql:host=localhost;port=3306;dbname=';
fastcgi_param PF-ENV-DB_NAME 'pathfinder';
fastcgi_param PF-ENV-DB_USER 'root';
fastcgi_param PF-ENV-DB_PASS '';
<?php
/**
* Created by PhpStorm.
* User: Exodus
* Date: 23.01.2016
* Time: 17:18
*
* Handles access to EVE-Online "CREST API" and "SSO" auth functions
* - Add your API credentials in "environment.ini"
* - Check "PATHFINDER.API" in "pathfinder.ini" for correct API URLs
@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;