Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@dadamssg
dadamssg / main.yml
Last active December 29, 2015 16:47
---
- name: Define release name.
set_fact: app_project_release={{ lookup('pipe', 'date +%Y%m%d%H%M%S') }}
- name: Set current release directory.
set_fact: app_current_release_dir={{app_project_root}}/releases/{{app_project_release}}
- name: Set shared directory.
set_fact: app_shared_dir={{app_project_root}}/shared
<?php
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Mapping\Driver\SimplifiedYamlDriver;
use Doctrine\ORM\Tools\Setup;
use Silex\Application;
use Silex\ServiceProviderInterface;
class DoctrineServiceProvider implements ServiceProviderInterface
@dadamssg
dadamssg / cli.php
Last active November 24, 2015 22:41
Incorporating a symfony console into a silex application.
#!/usr/bin/env php
<?php // app/cli.php
use Silex\Application;
use Symfony\Component\Console\Application as Console;
require __DIR__ . '/../vendor/autoload.php';
/** @var Application $app */
$app = require 'app.php';
<?php
namespace Acme\Project\Bundle\AppBundle\Data;
use Acme\Project\Model\App\Data\TransactionManager;
use Doctrine\ORM\EntityManagerInterface;
class DoctrineTransactionManager extends TransactionManager
{
/**

I'm trying to figure out how to best use events with a command bus. Does the following code look reasonable? It seems odd that the ResendConfirmationEmailHandler doesn't actually send an email or even have a mailer.

class ResendConfirmationEmailHandler
{
    /**
     * @var UserRepository
     */
    private $users;
 
<?php
class FizzBuzz
{
public function solve($start = 1, $end = 100)
{
for($i = $start; $i <= $end; $i++) {
$this->print($i);
}
<?php
namespace Acme\Project\Model\User\Value;
use Acme\Project\Model\Core\Validation\Assert;
final class PhoneNumber
{
/**
* @var string
<?php
namespace Acme\Project\Model\User\Value;
use Acme\Project\Model\Core\Validation\Assert;
final class PhoneNumber
{
/**
* @var string
<?php
namespace Acme\Project\Model\User\ValueObject;
class UserId
{
/**
* @var string
*/
private $id;
package CommandBus
import (
"reflect"
"sort"
"sync"
)
type HandlerFunc func(cmd interface{})