Skip to content

Instantly share code, notes, and snippets.

View immutef's full-sized avatar

immutef

  • SCAYLE GmbH
  • Hamburg, Germany
View GitHub Profile
@immutef
immutef / keybase.md
Created March 1, 2015 14:23
keybase.md

Keybase proof

I hereby claim:

  • I am pminnieur on github.
  • I am pminnieur (https://keybase.io/pminnieur) on keybase.
  • I have a public key whose fingerprint is 874D 6895 FCE7 B4C4 C9A8 8094 8F3E 7097 4B59 67F6

To claim this, I am signing this object:

@immutef
immutef / ValidatingCommandBus.php
Created November 29, 2014 09:46
ValidatingCommandBus for Broadway
<?php
namespace App\Bundle\Broadway\CommandHandling;
use App\Bundle\Exception\ValidationFailedException;
use Broadway\CommandHandling\CommandBusInterface;
use Broadway\CommandHandling\CommandHandlerInterface;
use Symfony\Component\Validator\Validator\ValidatorInterface;
class ValidatingCommandBus implements CommandBusInterface
@immutef
immutef / Vagrantfile
Created November 3, 2014 16:17
Vagrant Ansible Windows
# ...
if Vagrant::Util::Platform.windows?
config.vm.provision :shell, path: "windows.sh"
else
config.vm.provision "ansible" do |ansible|
ansible.playbook = "ansible/playbook.yml"
end
end
@immutef
immutef / ValidationFailedExceptionListener.php
Created October 4, 2014 13:55
Validation Exception Listener
<?php
namespace App\Listener\Exception;
use App\Exception\ValidationFailedException;
use JMS\DiExtraBundle\Annotation as DI;
use Symfony\Component\Console\Event\ConsoleExceptionEvent;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Output\ConsoleOutputInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
@immutef
immutef / AbstractService.php
Created September 26, 2014 10:36
Abstract Service Definitions with Constructor Arguments
<?php
abstract class AbstractService
{
public function __construct(SomeService $someService)
{
// ...
}
}
@immutef
immutef / mockery.php
Last active August 29, 2015 14:05
Mock
<?php
$mock = \Mockery::mock('FQCN');
$mock
->shouldReceive('foo')
->with(\Mockery::mustBe('bar'))
->andReturn('bar')
->once();
(function($, window, document, undefined) {
$(document).ready(function() {
// hier der code ...
});
})(jQuery, window, document);
<?php
abstract class AbstractService
{
public function __construct($required1, $required2)
{
// ...
}
}
<?php
namespace Acme\DemoBundle\Model;
use Symfony\Component\Validator\ExecutionContextInterface;
class MyModel
{
public $myProperty;
<?php
class Inception extends Exception
{
static private $timesThrown = 0;
public function __construct($message = null, $code = 0)
{
if (++static::$timesThrown <= 3) {
throw new Inception($message, $code);