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
const cluster = require('cluster'); | |
const http = require('http'); | |
const numCPUs = require('os').cpus().length; | |
const min = 5 * 1000; | |
const max = 10 * 1000; | |
const waitBeforeKill = 2 * 1000; | |
cluster.on("fork", (worker) => { | |
console.log("worker forked: ", worker.process.pid); |
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
for (var i=Math.floor(Math.sqrt(1000)); i < Math.ceil(Math.sqrt(9999)); i++) { | |
var n = i * i; | |
a = Number(n.toString().substring(0, 2)); | |
b = Number(n.toString().substring(2, 4)); | |
if ((a + b) === i) { | |
// TODO: format number to display in two digits | |
console.log(a, b); | |
} |
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
# Todo: time complexity of #feeds is N^2, reduce it. | |
def feeds | |
[].tap do |collection| | |
collect_feed_links[:feed_entries].entries.each do |entry| | |
collection.push(sanitize_entity_hash({}.tap do |entry_hash| | |
Constants::FEED_ATTR.each do |attr| | |
begin | |
(entry.respond_to?(attr) && entry.send(attr)) ? entry_hash[attr] = entry.send(attr) : '' | |
# Probably, can be done the same with below, depends on what santitize_entity_hash does | |
# entry_hash[attr] = entry.send(attr) |