Skip to content

Instantly share code, notes, and snippets.

View Dakuan's full-sized avatar
💭
😆

Dakuan

💭
😆
View GitHub Profile
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
var Thing = Backbone.View.extend({
template: MyNameSpace.ThingTemplate,
render: function(){
var html = this.template(this.model);
this.$el(html)
}
});
handlebars: {
options: {
namespace: 'XOT',
amd: true,
node: true,
partialRegex: /^/,
partialsUseNamespace: true,
processName: function (filename) {
var parts = filename.split('/');
// router.js
define(['router1', 'router2', 'router3'], function (R1, R2, R3){
return {
r1: R1,
r2: R2,
r3: R3
}
}
@Dakuan
Dakuan / Damn you safari
Last active August 29, 2015 14:05
Safari on occasion will add cache control header *after* clearing its cache. Not helpful...
// 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();
};
@Dakuan
Dakuan / gist:0bd201dc9dffd8127dec
Last active September 15, 2016 08:52
Towards a decoupled user interface

Towards a decoupled user interface

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.

Summary

  1. Identify vertical slices
  2. Start to expose view data as JSON
  3. Replace HAML templates with React
  4. Move existing javascript functionality into a Flux application
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
@Dakuan
Dakuan / HF
Created December 23, 2014 10:32
Heroku Features
### Deploy with git
```
git push heroku master
```
### Create new apps at will
```
heroku app:create
```
@Dakuan
Dakuan / iso.js
Last active August 29, 2015 14:13
two into one
// 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) {
return R.anyPredicates(
R.map(
R.contains,
R.pluck('id', topics)
),
R.ifElse(
R.has('topicIds'),
R.prop('topicIds'),
R.compose(
R.pluck('id'),