Skip to content

Instantly share code, notes, and snippets.

Avatar

Mark Friedrich exodus4d

View GitHub Profile
@exodus4d
exodus4d / morris.esm.js
Last active Feb 6, 2021
Morris.js - ES6 Module - Example
View morris.esm.js
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*/ = {};
View more_features.md

Related to: https://stackoverflow.com/questions/53540348/js-async-await-tasks-queue

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 Feb 17, 2019
reactphp NDJSON client decoder
View processJSON.php
<?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?
View winnmp.log
Terminating 80
Terminating ALL processes..
Terminating 6379
Terminating 9002
Terminating 9003
@exodus4d
exodus4d / index.php
Last active Sep 9, 2018
Pathfinder HTTP2 ServerPush
View index.php
<?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',
View PHP-FPM-respawn-issue.md

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 Jul 31, 2016
Pathfinder example map export JSON file
View second_map_2016_07_31.json
{
"config" : {
"id" : 2,
"name" : "second map",
"icon" : "fa-desktop",
"created" : 1469912015,
"updated" : 1469912085,
"scope" : {
"id" : 1,
"name" : "wh",
View develop-pathfinder.conf
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 '';
View sso.php
<?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 Aug 27, 2020
pathfinder.conf for Pathfinder (Nginx v1.11.8)
View pathfinder.conf
# 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;