Skip to content

Instantly share code, notes, and snippets.

View benhartley's full-sized avatar

Benedict Hartley benhartley

View GitHub Profile
@benhartley
benhartley / createBackgroundTransaction.js
Created September 16, 2015 09:37
New Relic examples
// Some of this is pseudo-code / redacted...
function get(routeName, params, res) {
...
return cache.get('hget', cacheKey, 'json')
.then(r => {
newRelic.endTransaction();
return r;
})
.catch(...);
> bbcthree-web@0.0.0 build /home/developer/bbcthree-web
> gulp build
Error: Cannot find module 'through2'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
var request = require('request');
var path = require('path');
var fs = require('fs');
var requestOptions = {
url: 'https://curation.test.api.bbci.co.uk/collections?about=31684f19-84d6-41f6-b033-7ae08098572a',
agentOptions: {
pfx: fs.readFileSync(path.resolve('./dist/server/certificates/bbc.cert.p12')),
passphrase: require('./certificates/passphrase')
}
{
"email" : "you@example.com",
"phone" : "+44 (0) 20 7033 9753",
"repo" : "http://github.com/user/repo",
"example1" : "http://www.example.com/",
"example2" : "http://www.example.com/",
"example3" : "http://www.example.com/"
}
@benhartley
benhartley / active_game.php
Created October 8, 2012 14:51 — forked from jonsherrard/active_game.php
active_game.php
<?
$this->facebook_id = $facebook_id;
$active_game = array_filter($games, function($game) {
return $game->active;
});
/*
# Not sure this is needed, the game with the lowest game_id should be returned.
if (count($active_game) > 1):