Skip to content

Instantly share code, notes, and snippets.

View tauren's full-sized avatar

Tauren Mills tauren

View GitHub Profile

Wide screen

Name Power Events Alerts Last Motion Watch Edit   Delete  
Camera 1 On   25     4 3 min ago [Play] [Edit] [Delete]
Camera 2 On   13     6 1 min ago   [Play] [Edit] [Delete]

Narrow screen

| Name | Power | Activity | Last Motion | Actions |

Keybase proof

I hereby claim:

  • I am tauren on github.
  • I am tauren (https://keybase.io/tauren) on keybase.
  • I have a public key ASB200ndWK4x0QjPxs9kLdZjlfhL5edNlQY4xJ8YyBByrwo

To claim this, I am signing this object:

@tauren
tauren / neutrino-custom.js
Last active March 14, 2017 20:35
Neutrino customization script WIP
'use strict';
// TODO: Upgraded to neutrino@beta (v5). Make sure to upgrade to final release version
// which should be available mid March. Here are some links on what has changed and
// how to update old config to new:
// https://github.com/mozilla-neutrino/neutrino-dev/blob/v5.0.0-beta/docs/upgrading-neutrino.md
// https://github.com/mozilla-neutrino/neutrino-dev/pull/86#issue-211140309
const merge = require('deepmerge');
const webpack = require('webpack')
@tauren
tauren / webrtc.js
Created February 17, 2017 20:01
Using RxJS for WebRTC icecandidate handling via WebSocket signaling server
// Create WebRTC peer and setup event handlers
let peer = new RTCPeerConnection(iceConfig)
// Subject for the websocket signalling server
let socketSubject = Observable.webSocket({
// deserialize each binary message received
resultSelector: e => deserialize(e.data)
})
// Filter for only icecandidate messages
.filter(msg => msg && msg.header && msg.header.event === 'icecandidate' && msg.body && msg.body.candidate)
@tauren
tauren / websocket.js
Last active February 10, 2017 19:18
RxJS websocket issue
let candidatesToSend = []
let candidatesReceived = []
let socketSubject = Observable.webSocket({
url: 'wss://...',
openObserver: {
next: e => {
e.currentTarget.binaryType = 'arraybuffer'
candidatesToSend.forEach(candidate => {
console.log('sending candidate', candidate)
module.exports = {
attributes: {
// The participation that submitted this entry
participation: {
model: 'participation',
required: true
},
@tauren
tauren / sails output
Created March 13, 2014 08:03
It seems that toJSON is being called on the results of another toJSON call.
STEP 1
npm install sails@beta -g
git clone git@github.com:coinprofit/sails-model-question.git
cd sails-model-question
npm init
sails lift
STEP 2
@tauren
tauren / isNotColletion.js
Created March 13, 2014 02:38
Sails.js policy that enforces current user as creator of models
module.exports = function(req, res, next) {
// Make sure request is for a single entity, not for a collection of entities
if (!req.params.id) {
return res.forbidden('error.noPermission');
}
return next();
};
var _ = require('lodash');
/**
* Make sure to always return an array. If an array is passed, then
* return the array. If passed a string, return an array containing
* that string. If passed undefined or null, return an empty array.
*
* @param [String|Array] values A string or an array
* @return [Array]
*/
@tauren
tauren / constructorAOP.js
Last active December 31, 2015 16:39
Looking for a way to apply AOP before, after, or around functions to an object constructor.
// Sipmle AOP after function
var after = function(base, after) {
if (!base) {
return after;
}
return function composedAfter() {
var res = base.apply(this, arguments);
after.apply(this, arguments);
return res;