Skip to content

Instantly share code, notes, and snippets.

Iain Cambridge icambridge

Block or report user

Report or block icambridge

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
icambridge / snippet.go
Last active Aug 29, 2015
Force template format
View snippet.go
c.Request.Format = "json"
View gist:11329286
go get
go get
revel test
icambridge / Constructor.php
Created Jun 5, 2014
Dependency Injection Examples
View Constructor.php
class Notify
* @var SenderInterface
protected $sender;
public function __construct(SenderInterface $sender)
icambridge / react-body.php
Created Jun 17, 2014
An example of how to get the request body
View react-body.php
require_once __DIR__ . "/../vendor/autoload.php";
$app = function (\React\Http\Request $request, \React\Http\Response $response) {
$data = new \React\Stream\BufferedSink();
$data->promise()->then(function($data) use ($request, $response) {
View recognition.feature
Scenario: Recognise outside of heirachry with line manager recognition approval and reward control table director approval
Given I am logged in to the system
And recognition approval is set to manual by line manager
And reward approval is set to manual with a budget control table of:
| Director | 100 |
| Plus one | 50 |
| Line Manager | 1 |
When I recognise someone outside of my heirarchy for "150"
Then the recognition status should be pending
And the reward status should control tabled
icambridge / exception.php
Created Nov 1, 2014
returning null compared to throwing an exception
View exception.php
$person = $peopleRepo->getLatest();
if (null === $person) {
$log->warn('No person found');
// becomes
View class.hh
class Example {
private int $numberNine = 9;
View gist:944f3f3ce5a65653bec5
define('WPSQT_VERSION', '1.2.1');
$oldVersion = get_option('wpsqt_version');
// Simple way of checking if an it's an update or not.
if ( !empty($oldVersion) && (version_compare($oldVersion, WPSQT_VERSION) < 0) ){
// Do upgrade stuff.
View five.yml
id: encoder.super_duper_silly
View gist:7204f478dfcb8c5e4811
vagrant@php7dev:/vagrant$ php benchmark.php
time: 1.4532651901245
memory usage: 6291456
vagrant@php7dev:/vagrant$ nano benchmark.php
vagrant@php7dev:/vagrant$ php benchmark.php
time: 0.29000401496887
memory usage: 4194304
You can’t perform that action at this time.