This file contains 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 cluster = require('cluster'); | |
if (true === cluster.isMaster) { | |
var map = {}; | |
function forkWorker(data) { | |
var worker = cluster.fork({data: data}); | |
map[worker.id] = data; | |
} |
This file contains 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 json_string = '{"big_number": 3754019163539080706}'; | |
var json_string_converted = json_string | |
.replace(/\s*:\s*(\d{16,})\s*\}/mg, ':"$1"}') | |
.replace(/\s*:\s*(\d{16,})\s*\,/mg, ':"$1",'); | |
var json = JSON.parse(json_string); | |
var json_converted = JSON.parse(json_string_converted); | |
console.log(json); // Precision lost |
This file contains 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
/** | |
* Finds last working/business day of the month. | |
* | |
* Not tested for cross-browser compability. Works in Node.js though. | |
* | |
* EXAMPLES: | |
* | |
* 1. Returns last day of the last month of the current year: | |
* | |
* var result = lastBusinessDayOfMonth(); |