Skip to content

Instantly share code, notes, and snippets.

View MarkySparky's full-sized avatar

Mark Caulfield MarkySparky

View GitHub Profile
@MarkySparky
MarkySparky / package.json
Created April 1, 2015 09:33
for beta-web-site
{
"name": "Beta-Web-Site",
"description": "Build environment for the Beta mygov.scot web site",
"version": "0.0.1",
"dependencies": {
"q": "^1.2.0",
"socket.io": "^1.3.5"
},
"repository": {
"type": "git",
@MarkySparky
MarkySparky / content-source.js
Created April 1, 2015 09:31
Content Source - fetches published content and notifies a ContentHandler of each published item.
/**
* Content Source - fetches published content and notifies a ContentHandler of each published item.
**/
module.exports = function (config, sessionId, contentFormatter, contentHandler) {
var restler = require('restler');
var async = require('async');
var authHeader = {
headers : {
@MarkySparky
MarkySparky / socketio-server.js
Created April 1, 2015 09:30
Serves socket IO on express
var app = require('express')();
var server = require('http').Server(app);
var io = require('socket.io')(server);
var grunt =require('grunt');
server.listen(9075);
app.get('/', function (req, res) {
res.send('Socket IO listnening');
res.sendfile(__dirname + '/index.html');
@MarkySparky
MarkySparky / socketio-handler.js
Last active August 29, 2015 14:18
socketIO handler
// ContentHandler that emits a socketio message on content creation
//
// The ContentSource will call the method of this object as it fetched the content.
module.exports = function() {
var fs = require('fs');
var df = require('dateformat');
var del = require('del');
var yaml = require('js-yaml');