Skip to content

Instantly share code, notes, and snippets.

View django-wong's full-sized avatar
👨‍💻
Focusing

Django Wong django-wong

👨‍💻
Focusing
View GitHub Profile
@django-wong
django-wong / example.js
Created October 21, 2018 15:05 — forked from ignlg/example.js
Fixes "TypeError: JSON.stringify cannot serialize cyclic structures" error when exporting to JSON a KeystoneJS model/list including virtuals.
var modelCleanCyclic = require('./modelCleanCyclic');
var Example = new keystone.List('Example', {});
Example.schema.set('toJSON', {
virtuals: true,
transform: modelCleanCyclic.transformer
});
@django-wong
django-wong / hosts.js
Created January 7, 2017 18:42 — forked from Swivelgames/hosts.js
Node.js: Simple "Virtual Hosts" with Bouncy
module.exports = [
[ 'sterm.bluelogicteam.com', 8881 ],
[ /^(www\.)?bluelogicteam.com$/, 8882 ],
[ /^(www\.)?toggleswitch.tv$/, 8883 ]
];