Tag: JavaScript
-
Airbnb style guide with Next.js
Starting a fresh Next.js project the other day, I was happy to see that configuring eslint was part of the bootstrapping process. Where things fell short for me, was the lack of a prompt asking me which style guide I’d like to use. I’m sure the out of the box option is sufficient enough, and…
-
Bitcoin price tracking widget for iOS with Scriptable
Of the crypto apps I have used, I’ve yet to find one that provides a Bitcoin price tracking widget to my liking. I’m not interested in the current price of Bitcoin, as I am interested in how my holdings (HODLINGS) are doing. Thus, enter Scriptable, an automation app for Apple devices. It allows you to…
-
Node.js REPL history
Node.js has included a persistent history with it’s REPL (real-eval-print loop) for quite some time now. It’s a fantastic quality of life feature, and it even supports reverse-i-search. The other day, I got to wondering, where the heck does this history even live? Turns out, it’s just living in a…
-
How to convert JSON to CSV in JavaScript
Last week we discussed converting CSV to JSON in JavaScript. This week, we’re going to talk about going in the opposite direction, converting JSON back to CSV. Similar to last week, we’re going to use the immensely popular papaparse library. As it turns out, even though it’s touted as the…
-
How to convert CSV to JSON in JavaScript
Parsing CSV data isn’t as easy as splitting the string up into individual lines, then splitting it by the delimited (in this case commas). Some of the values may have quotes around them, sometimes the values themselves have line breaks. Then there’s the potential that the data itself is malformed….
-
How to display a JavaScript array in HTML
From time to time, I see a search query that made it to my blog that piques my interest and inspires a post. This is one such post. How does one take an array (presumably in JavaScript) and display it in HTML? Now in this day in age, I would…
-
Splitting strings and keeping the separator in JavaScript
When splitting strings, the majority of the time, I don’t care about the separator (or delimiter), just the strings that exist between it. In JavaScript, that’s very simply with .split(): ‘one,two,three,four,five’.split(‘,’); Which will yield an array of strings like this: [‘one’, ‘two’, ‘three’, ‘four’, ‘five’] Great! But if we want…
-
Repeating Strings in JavaScript
While cleaning up some of my old notes today, specifically stuff I jotted down that would make for a good blog topic, I happened upon the topic of repeating strings in JavaScript. Things are really easy in ES6+, but if you happen to still support Internet Explorer for some crazy…
-
Overengineering Challenge: Is Number Even or Odd in JavaScript
Code golfing is fun, and makes for great blog posts. The problem is, the world is flooded with posts attempting to show you how to write the best / most concise code imaginable. With that, I decided that it would be a fun challenge to attempt to take a simple…
-
How to set the background color of a Google Chart
As luck would have it a Google Chart I had created some time last year, which was looking great for a while, recently decided that the background color of the chart itself was going to switch from the color I had set to the default color, white. This was quite…