Skip to content

Instantly share code, notes, and snippets.

View Kuirak's full-sized avatar

Jonas Kugelmann Kuirak

View GitHub Profile
@Kuirak
Kuirak / gun-test.ts
Last active March 25, 2018 04:02
Gun TS typings
import * as Gun from "gun";
interface Schema {
mark: Person;
}
var gun = Gun<Schema>();
gun.put("test"); // should fail
gun.put(["test"]); // should fail
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);
'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
}
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;
/**
* 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: {
'use strict';
/**
* Created by Jonas Kugelmann on 09.05.2014.
*/
var stream = require('stream')
,util =require('util');
var input1 = ['one','two','three','four','five'];
@Kuirak
Kuirak / client
Last active August 29, 2015 14:00
$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;