Skip to content

Instantly share code, notes, and snippets.

View dsseng's full-sized avatar

Dmitry Sharshakov dsseng

  • Austria
  • 11:09 (UTC +02:00)
View GitHub Profile
@dsseng
dsseng / vue-lscache.js
Created February 3, 2018 15:06
vue.js plugin for lscache
const lscache = require('lscache')
// This is your plugin object. It can be exported to be used anywhere.
const MyPlugin = {
// The install method is all that needs to exist on the plugin object.
// It takes the global Vue object as well as user-defined options.
install (Vue, options) {
// We add $ls for lscache
Vue.prototype.$ls = {
get: lscache.get,
@dsseng
dsseng / chatServer.js
Created February 2, 2018 15:25
Node.js and UWS scalable chat server using Redis (ioredis)
var WebSocketServer = require('uws').Server;
var wss = new WebSocketServer({ port: 3000 });
var Redis = require('ioredis');
var redis = new Redis('localhost', 6379);
var pub = new Redis('localhost', 6379);
redis.subscribe('msg', function (err, count) {
// Now we are subscribed to the 'msg' channel.
// `count` represents the number of channels we are currently subscribed to.