Skip to content

Instantly share code, notes, and snippets.

View vatson's full-sized avatar

Vadim Tiukov vatson

View GitHub Profile
@main-font-color: red;
@main-link-color: green;
body {
color: @main-font-color;
a {
color: @main-link-color;
}
}
<?php
$steps->Then('/^it should pass with:$/', function($world, $data) {
try {
assertEquals((string) $data, $world->output);
} catch (\Exception $e) {
$exceptionDiff = \PHPUnit_Framework_TestFailure::exceptionToString($e);
throw new \Exception($exceptionDiff, $e->getCode(), $e);
}
});
public function normalize($object, $format, $properties = null)
{
return $object->normalize($this, $format, $properties);
}
@vatson
vatson / gist:1089447
Created July 18, 2011 13:06 — forked from makasim/gist:1089373
enum
<?php
namespace Rj\CoreBundle\Enum;
abstract class Enum
{
/**
*
* @var array
*/
@vatson
vatson / gist:1171992
Created August 25, 2011 21:16
chain prototype
<?php
$exceptionFilter = new ExceptionFilterHandler();
$exceptionFilter->allow('MyBundle\AbstractException')
->ignore('MyBundle\ConcreteException');
$errorFilter = new ErrorFilterHandler();
$errorFilter->allow(UniversalErrorCatcher_ErrorCode::E_CORE_ERROR)
->ignore(UniversalErrorCatcher_ErrorCode::E_ERROR);
@vatson
vatson / gist:1177247
Created August 28, 2011 21:28
routers....
<?php
$filter = new Filter();
$filter->allow('MyBundle\AbstractException')
->ignore('MyBundle\ConcreteException');
$adapter = new SwiftAdapter();
$adapter->setClient(new Swift());
$systemProvider = new SystemProvider();
@vatson
vatson / gist:1180508
Created August 30, 2011 09:10
mail config
<?php
$adapter = new SwiftAdapter(new Swift());
$serializer = new Serializer(
array(new DataHolderNormailizer),
array('html' => new HtmlEncoder())
);
$configuration = new DataHolder();
<?php
Ett fel har inträffat när produkten skulle sparas
Vi hoppades naturligtvis att du aldrig skulle behöva se den här sidan, men den innehåller värdefull felsökningsinformation. Spara den och skicka in den till kundtjänst så kommer vi snabbare kunna lösa problemet.
[
{
"subject_class":"ProductSettings",
"subject_id":{
<?php
$loader = $this->getMock('Symfony\Component\Translation\Loader\LoaderInterface');
$loader
->expects($this->exactly(2))
->method('load')
->with(
$this->logicalOr(
$this->equalTo($resource1),
$this->equalTo($resource2)
),
@vatson
vatson / gist:1310210
Created October 24, 2011 20:48
Mockery rocks!
<?php
$this->customer = Mockery::finalMock('\\Customer');
$this->customer->shouldReceive('__get')->with('email')->once()->andReturn($email_address);
$this->customer->shouldReceive('__get')->with('first_name')->once()->andReturn($first_name);
$this->customer->shouldReceive('__get')->with('last_name')->once()->andReturn($sur_name);
$this->customer->shouldReceive('__get')->with('phone_number')->once()->andReturn($phone_number);
$this->customer->shouldReceive('__get')->with('cell_phone_number')->once()->andReturn($cell_phone_number);