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
let timer = 0; | |
let interval; | |
document.addEventListener('visibilitychange', () => { | |
if (document.visibilityState === 'visible') { | |
alert(timer); | |
clearInterval(interval); | |
timer = 0; | |
} else { | |
interval = setInterval(() => timer++, 1000); | |
} |
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
[ | |
"The program has never collected that information", | |
"That wasn't in the original specification", | |
"The project manager told me to do it that way", | |
"There's currently a problem with our hosting company", | |
"Well done, you found my easter egg!", | |
"That feature would be outside of the scope", | |
"This code was not supposed to go in to production yet", | |
"The client must have been hacked", | |
"I'm still working on that as we speak", |
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
let data = `[{"title":"eros sodales velit faucibus gravida","content":"Venenatis sem ac arcu litora facilisi turpis ligula sem nostra habitant sodales? Fames molestie non aenean facilisis nibh inceptos praesent vitae amet. Lacus fringilla conubia id penatibus euismod. Eleifend ultrices blandit gravida tortor interdum. Quis curabitur himenaeos interdum suscipit ipsum nisi lacus orci vel integer himenaeos sapien, sollicitudin posuere at, volutpat tristique class himenaeos turpis lectus vehicula maecenas vehicula sed bibendum et, inceptos euismod eget neque orci venenatis purus ultricies nec?"},{"title":"non cum ad elementum et","content":"Sodales torquent nunc potenti. Mattis urna penatibus iaculis aenean amet dignissim sollicitudin? Pretium pharetra enim tristique dolor inceptos sollicitudin, vestibulum condimentum leo hac nisi leo vehicula turpis taciti odio, orci bibendum blandit in dui quis eleifend nam phasellus urna commodo ullamcorper? In malesuada molestie ornare nibh ornare cursus platea et habi |
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
const Queue = require('bull'); | |
const pdfQueue = new Queue('pdf', 'redis://localhost:6379'); | |
const delay = (milliseconds) => | |
new Promise((resolve) => setTimeout(resolve, milliseconds)); | |
const CONCURRENCY = 2; | |
pdfQueue.process(CONCURRENCY, async function (job) { |