JavaScript All In: A poker hand evaluator sans conditional branches

Photo by Esteban Lopez on Unsplash

Building a team of developers requires a way to measure the talent and skill of candidates. During the early stages of a company, building out a core senior team requires a way to weed out imposters versus impressors. Using a technical coding challenge is one path to accomplish this.

My go-to test involves one of my favorite pastimes, poker. To be specific, incorporating a poker hand evaluation mechanism. Without leading candidates to a particular implementation, the challenge is open-ended to allow them to showcase their foundational programming knowledge and experience level.

I’ve witnessed the gamut of solutions, from elegant to…

Follow my journey into troubleshooting internet disruption issues after switching service providers.

Photo by Joshua Sukoff on Unsplash

Now that we are in an active-pandemic world, those lucky enough to continue remotely working rely on fast and reliable internet service. I’m a software developer by trade and run multiple video meetings a day to keep in touch with our engineering team. All of our systems and tools are in the cloud these days, and we expect that internet service is like electricity and running water.

Working at home now requires me to be the “I.T.” guy. …

Flash SciFi — Origins from an alternate future

Photo by Anita Denunzio on Unsplash

A buzzing vibration moved the air above like a hive of agitated bees. It got significantly louder as the train cleared its way to the next stop on The Loop’s elevated train tracks. A fleeting shadow tracked its movement and blocked the only sunlight that escaped to the street below. The floating form maintained a static hexagonal pattern, lacking any undulation.

The aircraft did not weave and bop about but continued on a seemingly pre-determined flight path. After a minute of observing its course, it appeared to be hundreds of drones, synchronized…

Photo by Zoran Borojevic on Unsplash

The rope dug in, pulled tight, constricted his neck while another line fell over his head like a broken halo. It landed across his shoulders, heavy braids, closing together in a coiled embrace.

He had never felt such anger, as the noose started etching a track, gouging a necklace of raw hatred. Both ropes fought against his weight in a rhythmic dance of resistance and gravity.

Hands shoved his back and shoulders to coax him off the ledge. He felt as if his feet were rooted in the cement, hoping it would not give. …

Frequently Asked Questions about living with a mini-pig in Chicago

I have asked myself and questioned my motives to bring a mini-pig into our household. We are a family of five with busy schedules and full-time working parents. When after-school activities, playdates, extended work hours, and household maintenance has squeezed the last second out of the day, adding a new baby (pet) may seem mad.

Relatives and friends also question our sanity as to why we would choose such an exotic animal as a pet. …

Photo by Daryl Baird on Unsplash

We deployed five different product offerings during the same period at less than half the cost of other startups of the same size.

Startups have been in my blood for the past two decades. Most startups failed for various reasons. Not a good product/market fit. Founders were inflexible for pivots. Too many pivots. Mismanagement of funds. Hired too early or built an ineffective core team. All these factors and a combination of others can lead to business closure before establishing a stable revenue stream.

Mistakes will be made along the way, but staying agile and nimble with small and frequent…

Photo by Josh Riemer on Unsplash

The hum of electromagnetic resonance radiated a bluish glow as ions dissipated into the air. Arm hairs on both scientists stood on end while they fiddled with dials and switches, tuning the frequencies of their experimental EM drive. A loud spark jumped from the metal canister to the power supply, and the test run ended when the circuit breaker popped.

“I thought you fixed the issue with the floating ground ring?” asked Scott.

Peter flipped his safety glasses to his forehead. Frustration flooded his face as he rubbed his eyes and scratched his head, thinking. …

Photo by Florencia Viadana on Unsplash

Through the decades of writing Javascript code, with its evolution from a front-end scripting language to a bonafide powerhouse, I’ve picked up some great one-liners. No, not those one-liners, but a piece of code so terse, you will be amazed at how powerful they are. But with great power, comes great responsibility — use it sparingly to avoid obfuscating the code into unreadable spaghetti.

Here are 13 of my favorite Javascript one-liners in no particular order.

*All examples using Node.js v11.x. Your usage may vary on client-side browsers.

1. Convert to Boolean

To convert a variable into a Boolean value without changing the original…

Tuan Pham-Barnes

I write code, flash fiction, commentary, and poetry; sometimes my code reads like poetry and my fiction becomes flash commentary!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store