Skip to content

Instantly share code, notes, and snippets.

Ross Tuck rosstuck

  • Utrecht
View GitHub Profile
View clock-example.php
<?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
{
View notes.md

“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 / 1-cookiejar.feature
Last active May 24, 2017
Behat / ES Helper
View 1-cookiejar.feature
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
View gist:38861a146509ab4cb485
<?php
namespace Derp;
abstract class Enum
{
protected $value;
protected static $possibleValues;
protected static function getPossibleValues()
View keybase.md

Keybase proof

I hereby claim:

  • I am rosstuck on github.
  • I am rosstuck (https://keybase.io/rosstuck) on keybase.
  • I have a public key whose fingerprint is A689 BB42 7A18 84FE 410B C170 2D05 8561 B39E D426

To claim this, I am signing this object:

@rosstuck
rosstuck / FormSet.php
Last active Jan 5, 2017
Symfony Formset
View FormSet.php
<?php
use \Symfony\Component\Form\FormInterface;
use \Symfony\Component\HttpFoundation\Request;
class FormSet
{
/**
* @var SplObjectStorage|FormInterface[]
*/
@rosstuck
rosstuck / EventGenerator.php
Created Mar 20, 2014
Simple EventGenerator trait that you might use with domain events
View EventGenerator.php
<?php
trait EventGenerator
{
protected $pendingEvents = array();
protected function raise($event)
{
$this->pendingEvents[] = $event;
}
@rosstuck
rosstuck / gist:2972413
Created Jun 22, 2012
Bootstrapping JMS
View gist:2972413
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;
View Javascript part
var redis = require("redis");
var client = redis.createClient();
client.on("message", function (channel, message) {
console.log(channel + ": " + message);
});
client.subscribe("broadcast");
You can’t perform that action at this time.