Skip to content

Instantly share code, notes, and snippets.

<?php
namespace Derp;
abstract class Enum
{
protected $value;
protected static $possibleValues;
protected static function getPossibleValues()
<?php
/**
* This is the clock interface. It's really simple, you write it once, use it anywhere.
* Cool extra things you can do:
* - have it return custom value objects
* - separate method for currentDate() without time part
*/
interface Clock
{
@rosstuck
rosstuck / EventGenerator.php
Created March 20, 2014 16:04
Simple EventGenerator trait that you might use with domain events
<?php
trait EventGenerator
{
protected $pendingEvents = array();
protected function raise($event)
{
$this->pendingEvents[] = $event;
}
@rosstuck
rosstuck / 1-cookiejar.feature
Last active May 24, 2017 12:03
Behat / ES Helper
Feature: Cookie Jar
Scenario: The last cookie put in the jar is the first eaten
Given I put a raisin cookie in the jar
And I put a chocolate cookie in the jar
When I eat a cookie
Then I should have eaten a chocolate cookie
Scenario: I eat multiple cookies
Given I put a raisin cookie in the jar
@rosstuck
rosstuck / FormSet.php
Last active January 5, 2017 11:28
Symfony Formset
<?php
use \Symfony\Component\Form\FormInterface;
use \Symfony\Component\HttpFoundation\Request;
class FormSet
{
/**
* @var SplObjectStorage|FormInterface[]
*/

“How We Talk About Tech” - Show Notes

Slides

I don’t think the slides are very useful on their own but you can find them here: http://rosstuck.com/dpc2016/#/.

(I was unable to create a decent PDF export, hence the self hosting).

Video

The talk was recorded but I don’t know when it will be released.

@rosstuck
rosstuck / gist:3481910
Created August 26, 2012 17:40
cheese om nom nom
Hello PFC!
@rosstuck
rosstuck / gist:2972413
Created June 22, 2012 12:17
Bootstrapping JMS
use Metadata\MetadataFactory;
use JMS\SerializerBundle\Serializer\Handler\DeserializationHandlerInterface;
use JMS\SerializerBundle\Serializer\Handler\SerializationHandlerInterface;
use JMS\SerializerBundle\Serializer\VisitorInterface;
use JMS\SerializerBundle\Serializer\XmlDeserializationVisitor;
use JMS\SerializerBundle\Serializer\Construction\UnserializeObjectConstructor;
use JMS\SerializerBundle\Serializer\JsonDeserializationVisitor;
use JMS\SerializerBundle\Serializer\Handler\ObjectBasedCustomHandler;
use JMS\SerializerBundle\Serializer\Handler\DateTimeHandler;
use JMS\SerializerBundle\Serializer\Handler\DoctrineProxyHandler;
@rosstuck
rosstuck / Javascript part
Created May 26, 2012 08:58
Redis pub/sub
var redis = require("redis");
var client = redis.createClient();
client.on("message", function (channel, message) {
console.log(channel + ": " + message);
});
client.subscribe("broadcast");
@rosstuck
rosstuck / gist:2665185
Created May 12, 2012 08:18
Satis github config
{
"name": "My Company Inc",
"homepage": "http://packages.mycompany.com",
"github": [
{
"account": "mycompany",
"username": "alice",
"password": "foobar"
}
]