This file contains hidden or 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
// Remove duplicates from an array | |
(function() { | |
Array.prototype.unique = function() { | |
return Array.from(new Set(this)); | |
}; | |
console.log([1, 2, 3, 4, 4, 5].unique()); // [1, 2, 3, 4, 5] | |
})(); | |
// Memoized function | |
(function() { |
This file contains hidden or 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
# to generate your dhparam.pem file, run in the terminal | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
This file contains hidden or 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
var request = require('request'); | |
var zlib = require('zlib'); | |
var tar = require('tar'); | |
var url = 'https://github.com/Shogun147/Katana/tarball/master'; | |
var path = __dirname + '/katana'; | |
request({ url: url }).pipe(zlib.createUnzip()).pipe(tar.Extract({ path: path })) | |
.on('end', function() { | |
console.log('Done!'); |
This file contains hidden or 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
var Http = require('http'); | |
var Fs = require('fs'); | |
// some url to big video file | |
var url = 'url'; | |
var path = 'save_path'; | |
var downloaded = 0; | |
var percents = 0; | |
var size = 0; |
NewerOlder