In order for the Quill Platform to utilise future proof web technologies a strategy needs to be devised to move from the current Ruby On Rails (RoR) application. The end goal is an independent node.js application backed by a Javascript Object Notation (JSON) Application Programming Interface (API). This document outlines a proposal for migrating from RoR to a standalone node.js web client.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
code=`curl -o /dev/null --silent --head --write-out '%{http_code}\n' http://website.com/bollocks` | |
echo $code | |
if [ $code -eq 200 ] | |
then | |
echo 'all good' | |
else | |
echo 'no good' | |
exit 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Thing = Backbone.View.extend({ | |
template: MyNameSpace.ThingTemplate, | |
render: function(){ | |
var html = this.template(this.model); | |
this.$el(html) | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
handlebars: { | |
options: { | |
namespace: 'XOT', | |
amd: true, | |
node: true, | |
partialRegex: /^/, | |
partialsUseNamespace: true, | |
processName: function (filename) { | |
var parts = filename.split('/'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// router.js | |
define(['router1', 'router2', 'router3'], function (R1, R2, R3){ | |
return { | |
r1: R1, | |
r2: R2, | |
r3: R3 | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// to hack round https://github.com/visionmedia/node-fresh/commit/f2c79c24b411ce56e051d1c8bf91b9d6a33e4e49 | |
module.exports = function (req, res, next) { | |
var cc = req.get('cache-control'); | |
if (/max-age\s*=\s*0/.test(cc)) { | |
req.headers['cache-control'] = 'no-cache'; | |
} | |
next(); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Do I want to stay? | |
if yes | |
what conditions are required? | |
spend political capital on getting those terms met | |
else | |
spend political capitcal on maximising exit by getting pay backdated | |
get new job |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Deploy with git | |
``` | |
git push heroku master | |
``` | |
### Create new apps at will | |
``` | |
heroku app:create | |
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// render-spa.js | |
var React = require('react'), | |
Router = require('react-router'), | |
routes = require('../../../build/server/ui/routes'), | |
fluxFactory = require('../../util/flux-factory'); | |
function renderSpa(res, data, path) { | |
var flux = fluxFactory(data); | |
Router.run(routes, path, function(Handler, state) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return R.anyPredicates( | |
R.map( | |
R.contains, | |
R.pluck('id', topics) | |
), | |
R.ifElse( | |
R.has('topicIds'), | |
R.prop('topicIds'), | |
R.compose( | |
R.pluck('id'), |