Aug 01, 2020

How to create a sticky footer with Flexbox

Creating a footer that sticks to the bottom of the browser window is something that most web developers have to tackle at some point in their careers. The challenge of the sticky footer is ensuring that the footer appears right at the bottom of the screen even if there is very little content on the […]

Jul 25, 2020

How to check how many times a character occurs in a string in JavaScript

When solving katas on Codewars, I often find myself needing to do some variation of find out how many times a character occurs in a given string and then doing some further steps with the result. Here’s my preferred solution to this task: const getCharCount = (str, char) => { return (str.match(new RegExp(char, ‘gi’)) || […]

Jul 19, 2020

How to check if a JavaScript array has duplicate elements

Here’s a one-liner for checking if an array contains any duplicate scalar values. This works by first converting the given array to a Set – a data structure containing only unique values. We then check whether the number of unique elements in the set is equal to the total number of elements in the array. […]

How to easily get a random boolean in JavaScript

I was just doing a coding challenge on Codewars where I had to randomly set the characters of a given string to either uppercase or lowercase. This required coming up with some means of randomly setting a character ‘s casing so a quick StackOverflow search gave me this nifty little trick: This works because Math.random() […]

Jul 17, 2020

A brief look at Web Workers

What is a web worker? A web worker is like a background thread that can run your JavaScript code in the background without affecting the current page by blocking other code. Workers can improve performance by allowing us to divide computationally expensive tasks among multiple workers, which can then perform those tasks on multi-processor cores. […]

May 29, 2020

Maybe we should limit our use of margins in CSS

Recently, I came across this short post by Max Stoiber, the author of styled-components, who argues that we should ban margins from our components. I suppose he was writing with React in mind but the idea extends to any component-based framework such as Vue or Angular. It’s a very short post but the gist of […]

Mar 05, 2020

A closer look at React’s Context API

TL:DR; Context gives us a way of sharing ‘global’ data with many components at different nesting levels. For someone who has worked with React for over 4 years, I must confess that my understanding of the Context API is not as solid as it perhaps should be. Having also recently rediscovered that teaching or writing is the […]

Feb 23, 2020

Django REST framework – Serializers

I’ve been playing about with Django REST framework lately and it seems that the concept of serializers is central in the framework. So in an attempt to solidify my own understanding of serializers, I thought I’d write a short blog post on it! What is a Serializer / serialization? In Django REST framework, serialization is the process of converting […]

Feb 15, 2020

Redux Saga 101

I have been working with React and Redux for about 4 years but until now had never used redux-saga. I had a few cursory glances through the documentation but the weird generator syntax put me off. Besides, the alternative, redux-thunk was good enough when it came to handling side effects such as API calls. But alas, my new […]

Jan 19, 2020

A little peek at the Serverless hype

Being a JavaScript developer, I have naturally felt insecure and outdated for some time because I didn’t know much about the revolutionary shiny concept of Serverless architectures. So I did what every modern JS developer does, I jumped headlong onto the hype train! Serverless in a nutshell Serverless applications are broken up into functions, and hosted by […]

Jan 18, 2020

Tools for improving productivity as a Front-end developer

If you work with modern JavaScript, you’re probably all too aware of the abundance of tools in the JavaScript ecosystem. It’s understandable to feel the infamous JavaScript fatigue when confronted with all these shiny technologies. Nevertheless, some of these tools are very useful and because I’m feeling in the mood for writing some Markdown, I’m going to […]

My favourite programming books

Here are some of the books that have had the most positive impact on me as a developer. 1. Refactoring I place this as number one because it was a real game-changer in terms of how it changed my perspective of programming. Before reading this book, I had heard of the importance of writing clean […]

Jan 12, 2020

Deploying static sites with Netlify

Having discovered Gatsby and how easy it makes the process of building static sites, I wanted to find a simple deployment solution that didn’t require having to mess with configuring and maintaining a traditional web server like Nginx. In the end, I decided to use Netlify which in its own words is described as follows: […]

Jan 10, 2020

Building a blog with Gatsby

I decided to give Gatsby a try and use it to build my own website. For those who don’t know what Gatsby is, it’s a React-based framework for building static sites. In other words, you build your pages using React components and Gatsby takes care of generating a bunch of static HTML, CSS and JS files when […]