Skip to content

Instantly share code, notes, and snippets.

View wouterj's full-sized avatar

Wouter de Jong wouterj

View GitHub Profile
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services">
<parameters>
<parameter key="wj_rst.typer.class">Wj\RstExtension\EventListener\RstTyper</parameter>
</parameters>
<services>
<service id="wj_rst.typer" class="%wj_rst.typer.class%">
<tag name="stoffer.event_subscriber" />
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services">
<parameters>
<parameter key="wj_rst.linter.code_shorthand.class">Wj\RstExtension\Linter\CodeShortHand</parameter>
<parameter key="wj_rst.linter.heading_level.class">Wj\RstExtension\Linter\HeadingLevel</parameter>
<parameter key="wj_rst.linter.md_markup.class">Wj\RstExtension\Linter\MdMarkup</parameter>
</parameters>
<services>
<?php
// ...
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer;
use Acme\DemoBundle\Entity\Post;
public function indexAction()
{
$post = new Post;
$builder = $this->createFormBuilder($post);
$form = $builder
<?php
class PostListController extends Controller
{
private $viewModel;
public function __construct()
{
$this->viewModel = $this->get('view_model.twig');
$this->on('data.post_list_served', array($this, 'listServed'));
<?php
namespace Wj\ForumBundle\Document;
use Doctrine\ODM\PHPCR\Mapping\Annotations as PHPCR;
use Symfony\Cmf\Component\Routing\RouteReferrersReadInterface;
/**
* @PHPCR\Document(referenceable=true)
*/
<?php
$this->capsule = $this->prophet->prophesize('Illuminate\Database\Capsule\Manager');
new EloquentInitializer($this->capsule->reveal());
Acme\ForumBundle\Document\Topic:
property:
title:
provider: [property, {slugify: true}]
exists_action: throw
not_exists_action: create
method:
getDate:
provider: datetime
exists_action: use
<?php
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Config\Loader\LoaderResolver;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\DependencyInjection\ContainerBuilder;
abstract class ContainerTestCase extends \PHPUnit_Framework_TestCase
{
protected $container;
<?php
// src/Acme/DemoBundle/Exception/AcmeDemoException.php
namespace Acme\DemoBundle\Exception;
/**
* Special interface for AcmeDemoBundle exceptions
*/
interface AcmeDemoException
{
@wouterj
wouterj / 1-mediator.php
Last active August 29, 2015 14:00
An Event Mediator that fits in a tweet
<?php
class M{function t($̀,$́){foreach(@$this->l[$̀]?:[]as$̃)$̃($́);}function a($̀,$́,$̃){$̂=&$this->l[$̀];while(@$̂[$̃])$̃.='a';$̂[$̃]=$́;krsort($̂,1);}}