Skip to content

Instantly share code, notes, and snippets.

Sarel van der Walt sarelvdwalt

Block or report user

Report or block sarelvdwalt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sarelvdwalt
sarelvdwalt / ResponseJSON.php
Created Jun 1, 2015
Symfony Response Object that creates a JSON object which envelopes your content in a "content" part and has "meta" data that you can add on to. I tuses the JMSSerializerBundle to make sure it serializes properly.
View ResponseJSON.php
<?php
/**
* User: sarel
* Date: 2015/05/31
* Time: 10:10 AM
*/
namespace AH\AQueueBundle\Helper;
use JMS\Serializer\SerializerBuilder;
View dogCatchesTail
try {
// something cool goes here
} catch (Tail $t) {
// write entry in diary
} finally {
// finally! fuck!
}
@sarelvdwalt
sarelvdwalt / cappedStaticCacheVAR.php
Last active Aug 29, 2015
Demonstrates how to have a static cache variable (array) which is capped to a maximum count of entries, with last-in-first-out.
View cappedStaticCacheVAR.php
<?php
/**
* Demonstrate how to have a static cache variable that is capped to a maximum count.
*
* User: sarel
* Date: 2014/03/06
* Time: 8:27 PM
*/
class testShifting {
You can’t perform that action at this time.