Skip to content

Instantly share code, notes, and snippets.

@maximilianschmitt
maximilianschmitt / server.js
Last active Nov 25, 2017
Redirects on the server with react-router, express and iniquest
View server.js
app.use(function(req, res, next) {
const router = Router.create({
routes,
location: req.path
});
router.run(function(Handler, state) {
router.transitionTo = function() {
const redirectUrl = router.makeHref.apply(router, arguments);
return Promise.reject({ reason: 'redirect', redirectUrl });
@maximilianschmitt
maximilianschmitt / gulpfile.js
Created Apr 27, 2015
Using watchify with gulp
View gulpfile.js
'use strict';
var gulp = require('gulp');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var notifier = require('stream-notifier');
var watchify = require('watchify');
gulp.task('browserify', function() {
var bundler = browserify('./src/main')
@maximilianschmitt
maximilianschmitt / readme.md
Last active Aug 29, 2015
Compiling your ES6 command line apps to work with node.js
View readme.md
@maximilianschmitt
maximilianschmitt / readme.md
Last active Aug 29, 2015
How to add an Istanbul code coverage badge to your GitHub repository
View readme.md
@maximilianschmitt
maximilianschmitt / readme.md
Last active Aug 29, 2015
Making your io.js command line apps compatible with node.js
View readme.md
View mock-socket.js
'use strict';
var EventEmitter = require('events').EventEmitter;
var mockSocket = function() {
return {
toServer: new EventEmitter(),
toClient: new EventEmitter(),
disconnect: function() {
this.toServer.emit('disconnect');
@maximilianschmitt
maximilianschmitt / jobs.js
Created Sep 3, 2014
Automated MySQL backups to S3 with node.js
View jobs.js
'use strict';
var mysqlBackup = require('./mysql-backup');
var schedule = require('node-schedule');
schedule.scheduleJob({ hour: 22, minute: 0 }, mysqlBackup);
You can’t perform that action at this time.