Skip to content

Instantly share code, notes, and snippets.

@fotinakis
fotinakis / target-application-actions.js
Last active August 29, 2015 14:14
Mixin to make nested Ember components skip bubbling actions to parent components (slightly hacky)
import Ember from 'ember';
/**
Targets a component's actions to bubble immediately to the application controller and
through the route hierarchy, skipping any parent component action handlers.
This allows us to avoid passing redundant args like:
<my-component myAction={{action "myAction"}} myOtherAction={{action "myOtherAction"}}>
...through many layers of nested components, at the cost of highly-coupling the actions
@tkh44
tkh44 / FileController.js
Last active March 10, 2020 09:04
Simple file upload for sails.js
module.exports = {
get: function (req, res) {
res.sendfile(req.path.substr(1));
},
_config: {
rest: false,
shortcuts: false
}
};
@paolorossi
paolorossi / html5-video-streamer.js
Created March 7, 2012 13:21
Node.js HTML5 video streamer
/*
* Inspired by: http://stackoverflow.com/questions/4360060/video-streaming-with-html-5-via-node-js
*/
var http = require('http'),
fs = require('fs'),
util = require('util');
http.createServer(function (req, res) {
var path = 'video.mp4';