After a few interviews this month I wanted to share a few nice exercises that would come up in technical interviews, and how I originally approached them.
This exercise is related to how asynchronous programming work. If you asked me, I would rather ask about how the event loop works instead of asking this particular question.
You are given the following code:
and you’re asked two questions
A few years ago I started working with Node. During that time I had the opportunity to work in different companies, different teams and very different scenarios: from Enterprise solutions to middle-size companies to a very wide spectrum of startups. In most of those teams I’ve found, small and big, improvements that repeated over time from one company to another. I’ve tried to shrunk them into a list of arbitrary length because I thought it could be useful to someone.
Disclaimer: each of these problems could have multiple solutions.
This is first on the list because it’s a fairly straightforward…
A colleague asked me to check on a test suite that had a test failing but the process was still exiting with code 0. The suite was using mocha and it was connecting to a RabbitMQ queue as initialization but the catch was, the module that was opening the connection to the queue was not exposing a method for closing the connection on teardown.
I then realized the process should not be exiting at all, since a connection was still open. In the teardown section of the test suite I found something similar to this:
*Insert your favorite facepalm…
Durante una caminata espacial en el 2013, el astronauta italiano Luca Parmitano se encontró a sí mismo en grave peligro — se estaba filtrando agua en su casco.
El agua rápidamente migró en cero-G a sus ojos, orejas y nariz. Pronto Luca estaba luchando por ver y escuchar y empezó a tener dificultad para respirar.
Afortunadamente, su compañero de la caminata espacial, Chris Cassidy, estaba cerca y guió a Luca a la escotilla y a salvo.
El espacio es lo suficientemente difícil para sobrevivir sin cascos llenos de agua, por lo que la NASA pausó todas sus caminatas espaciales que…
Developer, infosec aficionado, mentor and vegetarian.