2022-11-28
|~3 min read
|487 words
Imagine the following scenario: you have a javascript module that’s relatively complicated. So complicated that you’ve broken it down into a…
2022-11-28
|~1 min read
|179 words
A fairly common experience in the Javascript world is that when you want to make a method available for testing, it needs to be exported…
2022-11-28
|~2 min read
|310 words
I was working on updating my blog and I wanted to have excerpts. Unfortunately, the excerpts were coming in with a lot of additional context…
2022-11-28
|~5 min read
|966 words
Preamble I was recently working on porting my blog to Remix. As part of this, I needed to parse my markdown files that constitute all of the…
2022-11-28
|~1 min read
|109 words
I was working on a toy problem recently which involved something called a “Giga” second. This is 10^9 seconds. Easy enough, we can calculate…
2022-11-28
|~2 min read
|347 words
Imagine you have a prop that you want to be passed all the way through to the DOM. If you try and pass through a prop that isn’t…
2022-11-28
|~7 min read
|1238 words
Snowpack is a new(er) addition to the build tools available on the front-end. I had the opportunity to start a new project recently and I…
2022-11-28
|~2 min read
|225 words
I’m currently working on a single page app with React that uses React Router. When navigating between “pages” (that is the URL changed and…
2022-11-28
|~3 min read
|476 words
One of my favorite recent additions to Javascript is Optional Chaining. This behavior, which allows a program to quickly ascertain whether a…
2022-11-28
|~2 min read
|242 words
When we write media queries it’s mostly the case that we just need to reference that within our style sheet. What about those cases where we…
2022-11-28
|~5 min read
|958 words
I started programming after ES6 was released - which is to say, I missed a lot. One of those features I never really needed to understand…
2022-11-28
|~1 min read
|184 words
Javascript is the wild west. There are no rules. Or that’s what they tell me at a minimum. A large percentage of this blog is dedicated to…
2022-11-28
|~1 min read
|63 words
Themes are hard. I wrote about them previously here Emotion and Styled-Components aim to address this problem with a theme provider that…
2022-11-28
|~4 min read
|619 words
Generators are a language feature that I don’t see used very commonly - at least in Javascript land (I remember going to a php user group…
2022-11-28
|~2 min read
|223 words
Recently I was working with an API that was returning binary data of images. I wanted to render them to a page which led me to discover the…
2022-11-28
|~1 min read
|84 words
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get the use of getters seems to be much more common within the…
2022-11-28
|~3 min read
|405 words
When I write regular expressions, I often find myself grouping logic between parenthesis. The issue is that these groups are remembered and…
2022-11-28
|~2 min read
|235 words
Recently I wrote about my regular expression prowess with figuring out a pattern to match on markdown links. When I went to implement it…
2022-11-28
|~2 min read
|313 words
As regular expressions get longer and more complicated capture groups can be nice to organize the different pieces of a match. For example…
2022-11-28
|~4 min read
|685 words
In the Markdown Spec there are several ways to write a link. The most common way I’ve seen / used is a pair of brackets followed by…
2022-11-28
|~1 min read
|146 words
/*_ really just need to add some wrapping around this. the body’s there. _/ When handling errors, it’s sometimes convenient to handle based…
2022-11-28
|~3 min read
|516 words
Imagine we want to create an matrix with Javascript. Javascript provides a number of different options for this, but it’s one of those…
2022-11-28
|~4 min read
|656 words
*Note: A POJO is actually a “Plain Old Java Object”, but I’m talking about Javascript, so it’ll be “Plain Old Javascript Object” today…
2022-11-28
|~3 min read
|447 words
Unlike a list or a dictionary, in Python, tuples are immutable.1 This is clear when investigating the methods available on the object…
2022-11-28
|~5 min read
|994 words
Python has a very concise syntax for creating new lists called List Comprehension. List comprehension is a way to define a new list based on…
2022-11-28
|~2 min read
|212 words
One of the most challenging things when getting started with Javascript is understanding comparisons. To do so requires understanding a few…
2022-11-28
|~2 min read
|277 words
In learning more about password management and salting/hashing (which I wrote about here) - I found bcrypt (which I wrote about using here…
2022-11-28
|~2 min read
|320 words
For a while now I’ve known about Alerts. They’re the shouting from the rooftop equivalent of Javascript. Instead of simply logging some…
2022-11-28
|~5 min read
|926 words
Imagine you’re planning a dinner party. You have a table that can comfortably seat 6, but you have 20 friends. How many combinations can you…
2022-11-28
|~11 min read
|2147 words
I’ve written about debouncing and throttling in the past in the context of scroll events, but I wanted to take a moment and implement them…
2022-11-28
|~2 min read
|286 words
I was doing a little reading on Sets this morning and had a bit of an ‘a ha’ moment about why Sets are always unique. Let’s say we have an…
2022-11-28
|~7 min read
|1215 words
There are a number of different syntax highlighters for Javascript, but the one I’ve been using lately is PrismJS (due in large part to its…
2022-11-28
|~6 min read
|1005 words
I’ve written in the past about OO in Javascript, but recently I was working on learning more about heaps and as I pulled together my own…
2022-11-28
|~2 min read
|289 words
As one of the fortunate few (relatively) who learned to make websites after the ascendency of React, I find that I often struggle when…
2022-11-28
|~9 min read
|1783 words
When it comes to coding, there’s always something new to learn. One of the areas I find I have a hard time with are Take, for example, this…
2022-11-28
|~4 min read
|780 words
A little over a year ago, I first discovered the power of and and wrote about it Better Form Submissions with Event.preventDefault and…
2022-11-28
|~3 min read
|480 words
Frequently, I find myself needing to mock out (or fake) an asynchronous call to test my API I’m developing. I hate having to remember the…
2022-11-28
|~8 min read
|1468 words
Update: I wrote a follow up post on how to extend classes in Javascript. What are classes anyway? A class is an entity that is capable of…
2022-11-28
|~1 min read
|167 words
What does it mean when we say that is a transpiler? According to Shawn Wang (known on the internet as swxy), when transpiles, it “compile…
2022-11-28
|~2 min read
|332 words
If I were to list my strengths, web design wouldn’t top the list. None the less, I like learning about it and know that I’ll continue to…
2022-11-28
|~2 min read
|327 words
Recently, I was playing around with Next.js (simply referred to as Next from here on) to see how a framework might make building React…
2022-11-28
|~3 min read
|487 words
Another entry in my Package Discovery series. Today, I’m looking at logging with ! Two steps to easily generate more readable logs: Install…
2022-11-28
|~3 min read
|539 words
Progress toward a unified module system in Javascript is proceeding, but we’ve yet to arrive at a unified experience. While we wait, I ran…
2022-11-28
|~2 min read
|316 words
I had to find the average of a set with potentially undefined values. If a value was undefined, I wanted to skip it all together. For…
2022-11-28
|~3 min read
|590 words
When I was first learning about Javascript (so, several months ago), I found this article from Douglas Crockford about private variables and…
2022-11-28
|~5 min read
|902 words
There are a lot of different ways to approach date math (I’ve written about some in the past), but recently, I had to find the best way to…
2022-11-28
|~1 min read
|116 words
I was recently working on a project where I wanted a loading state while an API resolved. Instead of testing with a live API, I wanted to be…
2022-11-28
|~5 min read
|812 words
After thinking more about Lee Byron’s talk and some of the uses for fragments1, I still had some questions. Specifically - how do you reuse…
2022-11-28
|~1 min read
|148 words
When testing with the Chai assertion library, I like the syntax and how it reads. The example from the docs demonstrates this nicely…
2022-11-28
|~3 min read
|504 words
I’m a big fan of libraries like Moment and DayJS. They make dealing dates in Javascript so much easier. Sometimes though, you just need to…
2022-11-28
|~5 min read
|819 words
I often find myself looking up patterns for converting synchronous code into async variants in Javascript. Whether it’s remembering how…
2022-11-28
|~2 min read
|246 words
Continuing the trend of learning more about Javascript classes of late, I found the following recently and thought it was quite interesting…
2022-11-28
|~3 min read
|467 words
Recently I wrote about my aha realization of what exactly we’re doing when we pass the props that a class constructor receives to super. In…
2022-11-28
|~4 min read
|706 words
When we define a class component as a derivation of a base class, this gives us access to all of the base class’s public (and protected…
2022-11-28
|~2 min read
|367 words
I thought this was pretty cool. Imagine you want to create a file programmatically and allow a user to download it. For the sake of this…
2022-11-28
|~1 min read
|198 words
Came across an interesting example of a rarely used feature (at least for me) in Javascript creating unexpected results with Typescript…
2022-11-28
|~4 min read
|726 words
universe of options I want to highlight one way to create a subset of data. To get us started, let’s think about a universe of data. It’s a…
2022-11-28
|~1 min read
|91 words
In Javascript, Sets are Objects with a few special attributes. Notably, they’re iterable collections of unique elements. One of the…
2022-11-28
|~3 min read
|440 words
The other day I came across a pattern for creating objects I couldn’t quite understand. The code looked a little like this: My confusion was…
2022-11-28
|~1 min read
|198 words
Back in February I wrote a primer on exports and require. While the primer was helpful, one piece that never quite clicked, was how to…
2022-11-28
|~3 min read
|539 words
When asking users for their input, it’s often a pleasant user experience to allow them to submit the form by pressing “Enter”. In fact, that…
2022-11-28
|~3 min read
|533 words
Every time I’ve thrown an error, I’ve used the object. It turns out, however, you can throw anything. I probably knew this intuitively, but…
2022-11-28
|~2 min read
|265 words
About a year ago, I learned about bitwise operators and using them to swap elements of a list in place. With Array Destructuring, Javascript…
2022-11-28
|~1 min read
|103 words
Built into Javascript’s primitive are Regex methods such as and .1 We can use the latter to sanitize inputs. A simply way to clean a phone…
2022-11-28
|~2 min read
|374 words
In order to understand , part of the Node API, we must first understand its context. Namely, the module and how it fits within the realm of…
2022-11-28
|~2 min read
|308 words
Storybook supports static files, like images. But it wasn’t working for me. In fact, the way to make a story with a static file is really…
2022-11-28
|~3 min read
|430 words
I’ve been learning about some of the ways you can use destructuring to make my Javascript more declarative and communicate my intent more…
2022-11-28
|~4 min read
|766 words
For a long time, I hated seeing functions like this: . I thought this was just “code golf” (the idea of reducing a function to its shortest…
2022-11-28
|~3 min read
|450 words
When we say that Javascript is lexically scoped, what we mean is that a function will have access to the variables in the context in which…
2022-11-28
|~2 min read
|205 words
I recently came across a situation where I had two different props in a component that had the same name (they were in different parts of…
2022-11-28
|~3 min read
|460 words
NB: The below illustrations are inspired / adapted from MDN’s great page on QuerySelector. I did not come up with these examples (though I…
2022-11-28
|~4 min read
|613 words
Javascript’s built-in sort is powerful and fast. However, there are many times when you will want to sort in a custom fashion. Whenever I…
2022-11-28
|~4 min read
|702 words
I’ve been working on projects with larger data sets recently and have begun to notice that not all queries resolve in one or two…
2022-11-28
|~2 min read
|382 words
I was unifying multiple micro services into a single front-end. To do this efficiently, I wanted to create a single proxy that sat in front…