Image for post
Image for post
Photo by Reid Zura on Unsplash

Wouldn’t it be great if we could use the for…of loop to iterate over our own data structures? In this article, we will learn how to do this by creating our own Iterable Range and Queue data structures to understand iterables in JavaScript better.

What is Iteration?

One of the fundamental problems computers solve is automating tedious and repetitive tasks. If you’re a programmer and have solved at least one non trivial problem in your life, I’m sure you’ve used Iteration.

Iteration is the repetition of a given set of instructions in order to generate an outcome. For loops, while loops, do…while loops are examples of procedural control flow statements which allow code to be executed repeatedly, usually until a desired outcome is generated. …


Image for post
Image for post
Photo by Yuri Efremov on Unsplash

Books are wormholes to wonderland. Without reading, life would be a mistake. But reading and not remembering what you read is worse. It is time wasted!

I used to find myself reading an amazing book and then miserably failing to articulate the ideas of the book while telling a friend about it. Here are some tips to read better and remember what you read.

Read What You Love

Pick a book that interests you. Read the blurb and decide if it resonates with you. Not everyone would find Sapiens by Yuval Noah Harari “Thrilling And Breath Taking”. If you don’t like non-fiction, read fiction. If you like poetry, read poetry. …


Image for post
Image for post
Photo by Aziz Acharki on Unsplash

Simpler, succinct code is always better than complex and quirky solutions. It can be a challenge to find the right balance between short and readable solutions. Here are some tips to help you write JavaScript more productively.

1. Optional Chaining

The optional chaining operator (?.) allows us to do nested property lookups in an object without having to perform multiple null checks.

2. Nullish Coalescence

Inspired by C#, Nullish Coalescence made it to ES2020. It is a really handy binary operator that returns the first defined value.

You must be familiar with using the || operator to perform default value assignments like so:

But the trouble is, || is not safe to use with `falsey` values. …


Hi friend, hope you’re well!

Here are some articles that I think would be worth your time:

1. Iterables in JavaScript: Custom Iterables

Image for post
Image for post
Photo by Reid Zura on Unsplash

Wouldn’t it be great if we could use the for…of loop to iterate over our own data structures? In this article, we will learn how to do this…
Read more

2. Truly Reactive Forms in Angular: A Unique Approach

Image for post
Image for post
Photo by Luke Stackpoole on Unsplash

Reactive forms are not reactive enough in Angular. Especially when dealing with async observable data to pre-populate a form…
Read more

3. Automatically prefix JIRA issue numbers to Git commit messages

Image for post
Image for post
Photo by ZMorph Multitool 3D Printer on Unsplash

If you are lazy like me, you know it can get a little annoying having to type the issue number in every commit message. We can easily automate this using…
Read more

Have a great week ahead & Happy Engineering!

Niv From Byte Limes


Image for post
Image for post
Photo by Luke Stackpoole on Unsplash

Reactive forms are not reactive enough in Angular. Especially when dealing with async observable data to pre-populate a form. Having to subscribe and call methods like setValue and patchValue seems very imperative and can be a recipe for data races and memory leaks. It can especially get messy when bulk editing an array of domain models. In this article we explore a different approach to reactive forms. Keep reading to know more

Observable of Forms!

That’s right! We can think of forms as a stream of UI input elements. Since forms can be thought of reactive setters that a user uses to set the data model of the view layer. As the data model itself is a stream, the form elements can be thought of as a stream of UI elements mapped from the underlying data stream. …


Image for post
Image for post
Photo by ZMorph Multitool 3D Printer on Unsplash

If you are lazy like me, you know it can get a little annoying having to type the issue number in every commit message. We can easily automate this using the git prepare-commit-message hook which can prepend commit messages with JIRA issue number to the commit message extracted from the git branch name (and get the benefits of Smart Commits). You can use this trick for any issue tracker you might use. Read more to know how to do this.

TICKET-123 — a useful commit message

Naming your git branches

For this technique to work, you need to make sure that you include the issue number in the name of the git branch. You can use the git flow naming convention as long as the ticket number is in the branch name. …


Image for post
Image for post
Photo by Diego PH on Unsplash

Sometimes, we need to extend third party library reducers and add additive features on top of it. This can be done easily with the help of a simple trick.

NGRX is a reactive implementation of Redux architecture where reducers act as reactive setters to add data to our application’s Observable Store on listening to Actions.

Reducing Reducers

Alliteration Alert! (see what I did there)

Since we need to extend an existing reducer by adding additive features to it, we need to essentially concatenate the reducers. …


Image for post
Image for post
Photo by Aziz Acharki on Unsplash

TypeScript gives us the ability to improve the architecture of our JavaScript application with type safety and code documentation. However, it doesn’t turn on `strict mode` by default in order to keep the barrier to entry low for new adapters. Angular takes the same approach. It does not turn the strict mode when generating a new Angular Application unless explicitly specified. This can hinder us from taking full advantage of TypeScripts strongly typed nature which allows us to detect a whole class of bugs at compile time.

There is a way to reap the benefits of the strict mode immediately even if you have an existing application with hundreds or thousands of TypeScript files.


Auto switch Node.js version in your terminal without typing the `nvm use` command

Image for post
Image for post
Photo by Mohamed Nohassi on Unsplash

It can very quickly get annoying having to manually switch node versions each time you open up a terminal in your project root. Wouldn’t it be great if you could automatically switch your node version based on your project’s requirements? This simple trick will make your dev experience even better:

macOS/Linux

For this tutorial, we’re assuming that you have node version manager (nvm) installed on your linux/macOS system.

We can simply write a shell script that runs each time we open a terminal in a directory or when we change a directory. The script looks for a .nvmrc file in the directory and attempts to use that version. …


Image for post
Image for post
Photo by Micheile Henderson on Unsplash

It is a common misconception held by many that economics is the study of money. However, it is actually the study of the choices people make! It is simply that. The choices people make and the impact of these choices on their lives as well as the rest of the world. All choices that are made expend a cost in the form of resources. For example, you chose to read this article right now and the cost of that was you not doing anything other than reading this article. …

About

Nivrith Gomatam

Software Engineer living a polymath lifestyle in Adelaide, Australia

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