Skip to content

Instantly share code, notes, and snippets.

View prolic's full-sized avatar
💭
Writing Haskell

Sascha-Oliver Prolic prolic

💭
Writing Haskell
View GitHub Profile
@prolic
prolic / ZfClassmapTask.php
Created January 23, 2012 11:40 — forked from shevron/ZfClassmapTask.php
Zend Framework 2.0 style autoloader classmap generator task for Phing
<?php
/**
* Phing task to generate a Zend Framework style autoloader classmap file
*
* This task requires ZF 2.x to be in your include_path. You can run phing like
* so to enforce this:
*
* $ export PHP_COMMAND="php -d include_path=.:<path to zf library>:<path to pear>"
* $ phing ...
@prolic
prolic / acllistener.php
Created February 29, 2012 12:10
ACL Listener
<?php
namespace Application\Event;
use Zend\EventManager\StaticEventManager,
Zend\EventManager\EventDescription,
Application\Event\Exception\ForbiddenException,
Application\Event\Exception\UnexpectedValueException,
Humus\Di\Locator;
@prolic
prolic / CustomJsonApiSerializer.php
Created October 1, 2015 10:12
Custom JSON Api Serializer using Fractal and proxy pattern for https://github.com/thephpleague/fractal/pull/234
<?php
namespace My;
use League\Fractal\Pagination\CursorInterface;
use League\Fractal\Pagination\PaginatorInterface;
use League\Fractal\Resource\ResourceInterface;
use League\Fractal\Serializer\JsonApiSerializer;
class CustomJsonApiSerializer extends SerializerAbstract
@prolic
prolic / index.php
Created April 27, 2012 13:06
Generate a service locator when in development mode
$config; // array with di configuration
if (APPLICATION_ENV == 'development' || !class_exists('Application\Context') {
$di = new Zend\Di\Di($config);
$generator = new Generator($di);
$generator->setNamespace('Application')
->setContainerClass('Context');
$file = $generator->getCodeGenerator();
$file->setFilename(__DIR__ . '/../Application/Context.php');
$file->write();
@prolic
prolic / context.php
Created April 29, 2012 18:51
Generated locator
<?php
namespace Application;
use Zend\Di\Di;
class Context extends Di
{
public function newInstance($name, array $params = array(), $isShared = true)
@prolic
prolic / test.php
Created July 11, 2012 11:22
performance test on different isSubclassOf implementations
<?php
// our test cases
interface A {}
class B implements A {}
class C extends B {}
Verifying that +prolic is my blockchain ID. https://onename.com/prolic
@prolic
prolic / gist:a320d43ee1ca709384fb
Last active February 25, 2016 12:45
inheritance aggregate root with prooph
A minor patch to the aggregate repository is needed for this! see: https://github.com/prooph/event-store/pull/154
<?php
abstract class User extends \Prooph\EventSourcing\AggregateRoot
{
protected $type;
public function type()
{
@prolic
prolic / benchmark_batch_publishing.php
Created March 7, 2016 12:42
batch publishing benchmark
<?php
require 'vendor/autoload.php';
$amqpLibConnection = new \PhpAmqpLib\Connection\AMQPStreamConnection(
'localhost',
5672,
'guest',
'guest',
'/humus-amqp-test'
@prolic
prolic / confirm_test.php
Created March 7, 2016 21:06
Rabbitmq publisher confirm test
<?php
$connection1 = new \AMQPConnection();
$connection1->connect();
$connection2 = new \AMQPConnection();
$connection2->connect();
$channel1 = new \AMQPChannel($connection1);