Skip to content

Instantly share code, notes, and snippets.

Page Composer Service

Composition proxy replacement for ESI, uses node-trumpet.

Installation

git clone [email protected]:TSLEducation/service-page-composer.git
cd service-page-composer
npm install
@cliftonc
cliftonc / fifo
Last active September 22, 2022 06:13
Simple LIFO and FIFO queue in Redis
var redis = require("redis"),
client = redis.createClient(),
exitProcessor = false,
queueNext = function() {
process.nextTick(function() {
// Messages are pushed with RPUSH, making this a FIFO queue
client.blpop('queue', 1, queueFn);
})
},
queueFn = function(err, msg) {
/**
* Include selector
*/
var request = require('request');
/**
* Handler to take any data-url marked elements and replace the innerHTML with the destination content
*/
module.exports = function dataurl(selectorConfig, options) {
@cliftonc
cliftonc / gist:3864516
Created October 10, 2012 10:05
Sample message
{
"date": "20121010",
"hour": 9,
"minute": 59,
"data": {
"readCount": 1,
"timeOnSite": 0,
"landingPage": "home"
},
"article": "http://www.dailymail.co.uk/news/article-2215324/Jimmy-Savile-allegations-Unmask-OTHER-BBC-child-abusers-Police-reveal-shocking-scale-Savile-abuse-launch-hunt-accomplices.html",
@cliftonc
cliftonc / gist:2652981
Created May 10, 2012 13:27
Delete lots of redis keys
var smartDelete = function(clientName, queryKey, cb) {
var client = redis.getClient(clientName), noneRemaining = false, numDeleted = 0, lastK, duration;
async.whilst(
function () { return !noneRemaining; },
function (callback) {
client.spop(queryKey, function(err, key) {