Skip to content

Instantly share code, notes, and snippets.

@TianyiLi
TianyiLi / stomp-service.ts
Created December 9, 2016 01:23
StompJS use in backend
import * as Stomp from 'stompjs';
export class STOMPService {
public state: STOMPState;
public messages: Stomp.Message;
private config: StompConfig;
private client: Stomp.Client;
private resolvePromise: { (...args: any[]): void };
private connectCallBack: (mes: Stomp.Message) => any;
@TianyiLi
TianyiLi / netSpeed.ts
Created December 8, 2016 05:35
Net Speed with speedtest.net
import * as fs from 'fs';
import { EventEmitter } from 'events';
const speedTest = require('speedtest-net');
var wrap = (callback: Function) => {
try {
callback();
} catch (error) {
console.log(error);
}
@TianyiLi
TianyiLi / dbus-native.d.ts
Created December 1, 2016 07:49
dbus-native type definition
declare module "dbus-native" {
import * as net from "net";
import * as events from "events";
interface msg{
destination?:string ;
path?:string ;
'interface'?:any ;
member:string ;
signature?:any;