D3 Geo Projections Explained đź—ş

D3 is used extensively for drawing geographic visualizations. D3 uses GeoJSON for representing shapes on maps. This post explains how we can use D3 to convert GeoJSON, that looks like this: { "type": "FeatureCollection", "features": [{ "type": "Feature", "properties": { "subunit": "Albania", "su_a3": "ALB", //... //... }, "geometry": { "type": "Polygon", "coordinates": [ [ [20.590247430104906, 41.855404161133606], // ... [20.590247430104906, 41.855404161133606] ] ] } } into a rendered SVG element, that looks like this:...

 · Soham Kamani

How Games Are Programmed: An Introduction To The Core Concepts Required To Program A Video Game

So you want to build a video game? Cool! I’m not really a professional game developer myself, but I have made a few games here and there for fun. The architecture and patterns used for building games are a bit different from, say, developing a website or back-end service. In this post, we will walk through the core concepts that you, as a programmer, would need to know before you dive into creating your own game....

 · Soham Kamani

Javascript Closures Explained (With Examples)

One of the most important, but often misunderstood concepts in javascript is closures. Understanding closures unlocks programming patterns that would be difficult to use otherwise. In this post, we will understand what closures are, and go through a few examples to solidify our understanding of them. The Lifecycle Of A Function First, let’s take a look at a simple function: function getValue(){ var a = 1 var b = 2 return a + b } var val = getValue() console....

 · Soham Kamani

Implementing OAuth 2.0 with Node.js

OAuth2 is an authentication protocol that is used to authenticate and authorize users in an application by using another service provider. This post will go through how to build a Node.js application to implement the OAuth2 protocol. If you just want to see the code, you can view it on Github How OAuth2 Works Let’s take a brief look at the OAuth protocol before we jump into implementation. If you’ve ever seen a dialog like this, then you’ve probably used OAuth before:...

Last Updated:   · Soham Kamani

How express.js works - Understanding the internals of the express library ⚙️

If you’ve worked on web application development in node, it’s likely you’ve heard of express.js. Express is one of the most popular lightweight web application frameworks for node. In this post, we will go through the source code of express, and try to understand how it works under the hood. Studying how a popular open source library works, will help us make better applications using it, and reduces some of the “magic” involved when using it....

 · Soham Kamani

Using Enums In Javascript

This post will explain how to implement and use enumerations (or enum types) in Javascript. Enums are types that contain a limited number of fixed values, as opposed to types like Number or String which can have a wide range of values. This is useful for many situations: For example, when describing seasons in temperate climates, you’ll want to limit the options to certain possible values: Summer, Winter, Spring and Autumn....

Last Updated:   · Soham Kamani

Adding a Redis Cache To Your Node.js Server

NodeJs is known for its speed with respect to async tasks, but there’s still a lot of potential to make responses from your server even faster, sometimes by orders of magnitude. In this post, we are going to go through a brief introduction to the concept of caching, along with a tutorial on how to implement it using redis and an express server. What Is Caching? Normally, when you make a web server with a database, each request to the server entails one or more requests to the database, and some processing of the results before sending back a response....

 · Soham Kamani

Making (and deploying) an Interactive Telegram Bot in Node.js

This tutorial will go through a straightforward set of steps to get a responsive telegram bot up and running from scratch I spent a considerable amount of time figuring out how to make a functional telegram bot. I mean sure, the official introduction is good, but theres a lot of stuff about what bots are, and a few scattered instructions about the API, but not enough of structure for a beginner to get up and running quickly....

Last Updated:   · Soham Kamani

An Introduction to Promises in Javascript

Promises are arguably one of the trickiest concepts to grasp in the javascript world, and even if you know how to use them, it’s difficult to explain how they actually work. This FAQ style tutorial is meant for both beginners and intermediates in the world of promises. If you’re a beginner and have trouble grasping what a promise even is, then go on ahead and start from the first question....

 · Soham Kamani

How Is Javascript Asynchronous And Single Threaded?

Asynchronous programming is one of those programming paradigms that’s extremely difficult to fully understand, until you’ve done enough of it in practice. In an ideal world this shouldn’t be the case, so here’s yet another attempt to explain the concept of async programming, and why its different from parallel programming, in the context of javascript. Everything runs on a different thread except our code. At first glance, this sentence doesn’t seem to make a lot of sense....

 · Soham Kamani