This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as Gun from "gun"; | |
interface Schema { | |
mark: Person; | |
} | |
var gun = Gun<Schema>(); | |
gun.put("test"); // should fail | |
gun.put(["test"]); // should fail |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Event.findOne({type:event.type,session_id:event.session_id,timestamp:event.timestamp}).then(function(data){ | |
if(data){ | |
data.params =event.params; | |
return Q.ninvoke(data,'save') | |
}else{ | |
return Event.create(event).then(Event.publishCreate); | |
} | |
}).fail(sails.log.error); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var stream = require('stream') | |
,util =require('util'); | |
util.inherits(ConstantStream,stream.Readable); | |
function ConstantStream(constant){ | |
stream.Readable.call(this,{objectMode:true}); | |
this.constant =constant; //get count form Cache | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
util.inherits(ConstantStream,stream.Readable); | |
function ConstantStream(constant){ | |
stream.Readable.call(this,{objectMode:true}); | |
this.constant =constant; //get count form Cache | |
} | |
ConstantStream.prototype._read = function(){ | |
var value ={}; | |
value.name ='constant'; | |
value.data =this.constant; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Event.js | |
* | |
* @description :: TODO: You might write a short summary of how this model works and what it represents here. | |
* @docs :: http://sailsjs.org/#!documentation/models | |
*/ | |
module.exports = { | |
attributes: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
/** | |
* Created by Jonas Kugelmann on 09.05.2014. | |
*/ | |
var stream = require('stream') | |
,util =require('util'); | |
var input1 = ['one','two','three','four','five']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$sailsSocket.subscribe('event',function(message){ | |
if(message.verb ==='created'){ | |
$scope.events.push(message.data); | |
} | |
}); | |
$sailsSocket.get('/api/event/subscribe').success(function(data){ | |
console.log("Subscribed") | |
}); | |
$sailsSocket.get('/api/event').success(function(data){ | |
$scope.events =data; |