Skip to content

Instantly share code, notes, and snippets.

View simonmcmanus's full-sized avatar

Simon McManus simonmcmanus

View GitHub Profile
var output = sizlate.render($('div#example'), { ‘h1’: ‘Goodbye’});
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/service-worker.js');
} else {
appCacheNanny.start()
}
appCacheNanny.on('updateready', function () {
location.reload()
})
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/service-worker.js');
} else {
appCacheNanny.start()
}
appCacheNanny.on('updateready', function () {
location.reload()
})
@simonmcmanus
simonmcmanus / gist:0638faf03ba09bd480536bff53d68b30
Created August 23, 2016 08:04
joi validate query string as array: ?userIds=1&userIds=2
validate: {
params: {
userIds: Joi.array().items(Joi.string()).required().min(1)
}
},
@simonmcmanus
simonmcmanus / gist:079f61c0e51fff4f38329df0c7511956
Created July 23, 2016 07:43
app manifest with components and pages
'use strict'
/**
* Generates an app cache file based on the spec provided.
*/
var fs = require('fs')
var files = [
'CACHE MANIFEST'
]
@simonmcmanus
simonmcmanus / gist:ea5fa587ec04a29c868a3b788207e8a3
Created May 3, 2016 18:25
broken render with transitions for lnug
'use strict'
var async = require('async')
var sizlate = require('sizlate')
var doSizlate = require('./do-sizlate')
var getFile = require('./read-file')
var loadComponents = require('./load-components')
/**
@simonmcmanus
simonmcmanus / avoid
Created April 6, 2016 08:43
avoid using projRequire in NodeBB
var path = require('path');
require.main._req = require.main.require;
require.main.require = function(mod) {
if ((mod.startsWith('./') || mod.startsWith('/'))) {
var fullPath = path.join(__dirname,'\\',mod);
return require.main._req(fullPath);
}
return require.main._req(mod);
}
{
"title": " --- Become Pirate legends in a trecherous shared world --- ",
"play": "play trailer"
}
{
"trailer": {
"id":"pyveR8bKLfA"
},
"updated": {
"id":"pyveR8bKLfA"
}
}
{
"header": "This is the header",
"middle": "I got somewhere in the middle",
"footer": "This is the footer"
}