Skip to content

Instantly share code, notes, and snippets.

@delwar2016
delwar2016 / socket.id
Created July 14, 2017 13:51
socket.id
https://gist.github.com/crtr0/2896891
https://socket.io/docs/rooms-and-namespaces/
@delwar2016
delwar2016 / Google Extension
Created July 19, 2017 14:27
Google Extension
Need to create extension:
1. manifest.json
2. 19x19px PNG file
3. popup.html
4. popup.js
@delwar2016
delwar2016 / install SSL certificate
Last active October 9, 2017 10:55
install SSL certificate
https://certbot.eff.org/#ubuntutrusty-nginx
https://askubuntu.com/questions/363200/e-unable-to-correct-problems-you-have-held-broken-packages
Use aptitude instead of apt-get. It is more intelligent. It not only will handle downgrading conflicting packages for you, but will make a series of recommendations asking you which of many possible suggested working scenarios you would like.
sudo aptitude install myNewPackage
If you don't have aptitude on your machine yet, get it with
@delwar2016
delwar2016 / Using Sinon to stub Mongoose calls and return Promise
Last active May 23, 2023 08:25
Using Sinon to stub Mongoose calls and return Promise
Suppose we have a schema as follows
var User = require('./schemas/UserSchema').User;
and we want to write unit test for like bellow code:
var getUserById = function () {
return User.findOne({_id: '001'}).exec();
};