Skip to content

Instantly share code, notes, and snippets.

AnrDaemon / Makefile
Created May 24, 2020
PHAR / stream_resolve_include_path test
View Makefile
SHELL := /bin/sh
PHAR_FILES := index.php
-rm index.php example.phar
dist-clean: clean
AnrDaemon / panel.html
Created Mar 29, 2020
Manual xdebug trigger script
View panel.html
<!DOCTYPE html>
<link rel="shortcut icon" href="/favicon.png" type="image/png"/>
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/>
<base target="_blank" />
AnrDaemon / tc-test.btm
Created Mar 28, 2020
TCC crash on return from subroutine call
View tc-test.btm
GOSUB test %[1]
ECHO %[1]:Ok
:test [rc]
REM "%[SystemRoot]\System32\cmd.exe" /S /K "EXIT %[rc]"
.\testme.exe %[rc]
AnrDaemon / git-pushing-multiple.rst
Created Sep 12, 2019 — forked from rvl/git-pushing-multiple.rst
How to push to multiple git remotes at once. Useful if you keep mirrors of your repo.
View git-pushing-multiple.rst

Pushing to Multiple Git Repos

If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.

Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.

If in doubt about what git is doing when you run these commands, just

AnrDaemon / rollyourown.php
Created Jun 28, 2019 — forked from GDmac/rollyourown.php
We don't need no DIC libs / we don't need no deps control
View rollyourown.php
// Context: I'm trying to argue that DI (and DIC) are great, and DIC libs suck.
// Happy to be proven wrong!
final class Router {
private $dependencies;
public function __construct (Dependencies $dependencies) {
$this->dependencies = $dependencies;
// You might say that this is Service Locator, but it's not. This router is toplevel,
// and toplevel must have access to dependencies. After that it can all just bubble nicely using proper DI.
View nginx-auth-subrequest.tcl
location ^~ /uploads/documents/ {
alias /volume/data/documents/;
set $auth_pass "$request_uri";
auth_request /auth/documents;
auth_request_set $auth_status "$upstream_status";
location ^~ /auth/ {
proxy_pass "http://back:8080/auth/$auth_pass";
View PageUnitsCollection.php
/** Collection handler for webpage content blocks
* @version SVN: $Id: PageUnitsCollection.php 1231 2018-08-11 19:40:50Z anrdaemon $
namespace AnrDaemon\CcWeb\Helpers;
View named-constructor.php
namespace AnrDaemon;
class Xxx
implements \JsonSerializable, \Serializable
public static function createFromState(array $state)
$self = new static();
AnrDaemon / apiaware.php
Last active Mar 25, 2020
Domain to infrastructure chained API interaction
View apiaware.php
/** Wrapper for actual thing that do the network talking.
This could be encapsulation for curl, Guzzle, Net\Browser, etc.
The wrapper offers a known stable interface to external library.
class Service\Api\Wrapper
View create-validator.php
class Utility
public function createValidator($spec)
list($type, $name) = explode(":", $spec, 2) + ['', ''];
$options = ["default" => null];