Skip to content

Instantly share code, notes, and snippets.

View geerteltink's full-sized avatar
🏠
Home office

Geert Eltink geerteltink

🏠
Home office
View GitHub Profile
@geerteltink
geerteltink / TwigMoneyExtension.php
Created June 12, 2019 14:35
Twig PHP Money Extension
<?php
declare(strict_types=1);
namespace App\Infrastructure\View;
use Locale;
use Money\Currencies\ISOCurrencies;
use Money\Formatter\DecimalMoneyFormatter;
use Money\Formatter\IntlMoneyFormatter;
@geerteltink
geerteltink / maintainers.md
Last active May 6, 2020 04:35
Laminas Maintainers Quick Reference

Laminas Maintainers Quick Reference

This guide is intended for maintainers — anybody with commit access to one or more Laminas repositories. It's a quick version of the original maintainers guide without the noise and extra tools to merge PR's and create releases faster.

Preparations:

@geerteltink
geerteltink / TemplateDefaultsMiddleware.php
Created March 29, 2018 10:21
Zend Expressive injecting default variables into templates.
<?php
declare(strict_types=1);
namespace Xtreamwayz\Expressive\TwigExtras\Middleware;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
@geerteltink
geerteltink / bin\console
Last active March 10, 2018 07:54
Zend Expressive Symfony console with lazy loaded services
#!/usr/bin/env php
<?php
declare(strict_types=1);
require __DIR__ . '/../vendor/autoload.php';
use Symfony\Component\Console\Application;
use Zend\ServiceManager\Proxy\LazyServiceFactory;
use Zend\ServiceManager\ServiceManager;
@geerteltink
geerteltink / DoctrineUserRepository.php
Last active January 10, 2022 17:32
zend-expressive-authentication with doctrine
<?php
declare(strict_types=1);
namespace App\Infrastructure\Repository;
use App\Domain\User\User;
use App\Domain\User\UserRepository;
use Doctrine\Common\Collections\Criteria;
use Doctrine\Common\Persistence\ObjectRepository;
@geerteltink
geerteltink / PHP_FPM_DEBIAN_SLIM_Dockerfile
Last active January 24, 2018 17:45
Slim Debian 9 php-fpm image
FROM debian:stretch-slim
LABEL description="Slim Debian 9 php-fpm image"
LABEL maintainer="@xtreamwayz"
RUN \
# Install build dependencies
apt-get update -y \
&& apt-get install -y --no-install-recommends wget apt-transport-https lsb-release ca-certificates \
@geerteltink
geerteltink / Zend\Validator\File\UploadFile.php
Created August 7, 2017 20:27
Zend\Validator\File\Psr7UploadFile.php
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
namespace Zend\Validator\File;
@geerteltink
geerteltink / catch-all.js
Last active July 5, 2017 19:56
Some Hubot scripts
'use strict';
// Description:
// Catch all unhandled messages directed to me.
//
// Notes:
// If nothing else catches a message, it's mine!
module.exports = (robot) => {
robot.catchAll((msg) => {
@geerteltink
geerteltink / json-stringify-parse.js
Last active November 5, 2023 16:19
Using JSON.stringify (toJSON) and JSON.parse (fromJSON) to (re)store JavaScript classes
class Commit {
constructor(sha, payload) {
this.sha = sha;
this.repository = payload.repository;
this.created = new Date();
}
toJSON() {
return Object.assign({}, this, {
created: this.created.toString()
@geerteltink
geerteltink / CreateMiddlewareActionCommand.php
Created June 23, 2017 05:55
zend-expressive-tooling command examples
<?php
declare(strict_types=1);
namespace App\Application\Console;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Zend\Expressive\Tooling\CreateMiddleware\CreateMiddleware;