Skip to content

Instantly share code, notes, and snippets.

View baldurrensch's full-sized avatar

Baldur Rensch baldurrensch

  • Sourceability LLC
  • Irvine, CA
View GitHub Profile
[~/code]$ git clone https://github.com/TheFootballSocialClub/FSCHateoasBundle.git Hateoas
Cloning into 'Hateoas'...
remote: Counting objects: 1487, done.
remote: Compressing objects: 100% (655/655), done.
remote: Total 1487 (delta 837), reused 1351 (delta 711)
Receiving objects: 100% (1487/1487), 186.06 KiB | 203 KiB/s, done.
Resolving deltas: 100% (837/837), done.
[~/code]$ cd Hateoas
[~/code/Hateoas]$ composer install --dev [master]
Loading composer repositories with package information
[12:05][brensch@Baldur-Renschs-MacBook-Pro:~/code/www-halo](master)$ sudo vagrant provision
Password:
[default] Running provisioner: Vagrant::Provisioners::Puppet...
[default] Running Puppet with /tmp/vagrant-puppet/manifests/ecom.pp...
notice: /Stage[main]/Hautelook/Host[memcache03]/ip: ip changed '10.0.200.31' to '127.0.0.1'
notice: /Stage[main]/Hautelook/File[ca-bundle.crt]/content: content changed '{md5}661bdf31600c25dd28e1a69c6991c476' to '{md5}c4290b9deb70d0bef2f88b67fc68c8ec'
notice: /Stage[main]/Hautelook/Host[memcache04]/ip: ip changed '10.0.200.31' to '127.0.0.1'
@baldurrensch
baldurrensch / TimeReportingTestListener.php
Created December 19, 2012 17:53
A PHP Unit Listener that records individual test time runs and can print out warnings if a test is slower then some critical threshold
<?php
namespace Hautelook\ApiBundle\Tests;
use PHPUnit_Framework_TestListener;
use PHPUnit_Framework_Test;
use PHPUnit_Framework_TestSuite;
use PHPUnit_Framework_AssertionFailedError;
use Exception;
@baldurrensch
baldurrensch / CustomHandler.php
Created December 21, 2012 15:29
This is a handler for the JMS serializer to handle parent and child type serialization. You need to set the type of your collection as `@Type("\Acme\MyBundle\Model\ChildType")`, so that the serializer picks up the handler correctly. Also remember that you need to hook up the handler as a service (and give it the correct tag).
<?php
namespace Acme\MyBundle\Serializer\Handler;
use JMS\Serializer\Handler\SubscribingHandlerInterface;
use JMS\Serializer\EventDispatcher\Event;
use JMS\Serializer\GraphNavigator;
use JMS\Serializer\XmlSerializationVisitor;
use JMS\Serializer\GenericSerializationVisitor;
@baldurrensch
baldurrensch / DemoController.php
Created January 2, 2013 18:49
How to use the All Validator
<?php
use Symfony\Component\Validator\Constraints\Email;
use Symfony\Component\Validator\Constraints\All;
// This is reduced to the bare minimum. Missing Namespace and other imports
class DemoController extends Controller
{
function testAction()
{
<?php
namespace Ibms\AppBundle\Form\EventListener;
use Doctrine\ORM\QueryBuilder;
use Ibms\SupplierBundle\Entity\Supplier;
use Ibms\SupplierBundle\Entity\SupplierManager;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\FormFactoryInterface;
@baldurrensch
baldurrensch / XHGuiTestListener.php
Last active December 14, 2015 12:09
This test listener insert profiling information for every unit test run.
<?php
namespace BR\PHPUnitTestListeners;
use PHPUnit_Framework_TestListener;
use PHPUnit_Framework_Test;
use PHPUnit_Framework_TestSuite;
use PHPUnit_Framework_AssertionFailedError;
use Exception;
$router = $this->get('router');
$route = $router->match("/api/search/test");
print_r($route);
> Running command "phpunit --coverage-clover '/tmp/php-code-coverageMkj99j'"...
>
>
>
> [Symfony\Component\Process\Exception\ProcessFailedException]
> The command "phpunit --coverage-clover '/tmp/php-code-coverageMkj99j'" failed.
>
> Output:
> ================
> PHPUnit 3.7.22 by Sebastian Bergmann.
<?php
$elements->filter(
function($elem) use ($target) {
return $elem->getId() == $target;
}
);