JavaScript

JavaScript covering both Frontend and NodeJS. Build bundles with Webpack or Parcel, create task runners, or endure our criticism of the JavaScript ecosystem.
NodeJS
06 May 2019

Fixing your NPM Installation

Fixing an npm installation gone wrong when 'sudo' is misused.
Fixing your NPM Installation

There's a bit of a headache going around in respect to global npm permissions. For those of us working on Unix-based systems, it's not uncommon to come across error messages complaining about your user permissions whenever installing new npm packages, especially when installing them globally. If errors like the one below  look familiar, you're not alone:

npm WARN checkPermissions Missing write access to /Users/toddbirchard/.npm-packages/lib/node_modules
npm ERR! path /Users/toddbirchard/.npm-packages/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/Users/toddbirchard/
Continue Reading
GraphQL
09 Mar 2019

Building a Client For Your GraphQL API

Now that we have an understanding of GraphQL queries and API setup, it's time to get that data.
Building a Client For Your GraphQL API

If you had the pleasure of joining us last time, we had just completed a crash course in structuring GraphQL Queries. As much we all love studying abstract queries within the confines of a playground environment, the only real way to learn anything to overzealously attempt to build something way out of our skill level. Thus, we're going to shift gears and actually make something with all the dry technical knowledge we've accumulated so far. Hooray!

Data Gone Wild: Exposing Your GraphQL Endpoint

If you're following along with Prisma as your GraphQL service, the endpoint for your API defaults to

Continue Reading
NodeJS
20 Feb 2019

Making API Requests With node-fetch

Using the lightweight node-fetch library for REST API requests in NodeJS.
Making API Requests With node-fetch

If you're the type of person to read technical Javascript posts in your free time (you are), you don't need me to tell you that JQuery is dead. JQuery themselves have proclaimed JQuery to be dead. The only cool thing about JQuery is who can remove it from their legacy stack the fastest, which begs the question: why is the third most popular page on this site an old post about JQuery?

Maintaining a blog of tutorials has taught me a lot about the gap between perception and reality. While we content publishers sling Medium posts from our ivory towers,

Continue Reading
NoSQL
14 Dec 2018

Complex Features in MongoDB Cloud: Add Image Tags with AI

Using functions, webhooks, and values to utilize external APIs.
Complex Features in MongoDB Cloud: Add Image Tags with AI

Friends, family, and most importantly, strangers: I approach you today with a tale of renewed inspiration. After loudly broadcasting my own confusion and mediocre ability to actually implement an effective cloud via MongoDB Stitch, my ineptitude has been answered with an early Christmas gift.

My incessant complaining gained some acknowledgement from a couple of folks over at MongoDB. Perhaps the timing is simply by chance, but since then I've begun noticing something some subtleties in the Stitch documentation; namely that if you look hard enough, some of it begins to make sense. Either way, I'm chalking this one up as

Continue Reading
NoSQL
26 Nov 2018

MongoDB Stitch Serverless Functions

A crash course in MongoDB Stitch serverless functions: the bread and butter of MongoDB Cloud.
MongoDB Stitch Serverless Functions

At times, I've found my opinion of MongoDB Atlas and MongoDB Stitch to waver between two extremes. Sometimes I'm struck by the allure of a cloud which fundamentally disregards schemas (wooo no schema party!). Other times, such as when Mongo decides to upgrade to a new version and you find all your production instances broken, I like the ecosystem a bit less.

My biggest qualm with MongoDB is poor documentation. The "tutorials" and sample code seems hacked-together, unmaintained, and worst of all, inconsistent with itself. Reading through the docs seems to always end up with Mongo forcing Twilio down my

Continue Reading
JavaScript
21 Nov 2018

Image Compression Using Gulp and Imagemin

The simplest way to optimize page speed without breaking everything.
Image Compression Using Gulp and Imagemin

I promised myself I wouldn’t get involved in any more Gulp tutorials; task runners aren’t exactly the sexiest topic in the world, and chances are if you’ve made it to this blog, you’ve either solidified a CI/CD pipeline for going live with software, or you simply don’t need one. We’ll make an exception this time, because gulp-imagemin is particularly dope.

Imagemin is a standalone Node library which also comes with a CLI, and of course, a Gulp plugin. In short, imagemin compresses images in a given directory and is intelligent enough to recognize

Continue Reading
NoSQL
15 Nov 2018

MongoDB Cloud: "Backend as a Service" with Atlas & Stitch

MongoDB's silent transformation from an open-source database to enterprise cloud provider.
MongoDB Cloud: "Backend as a Service" with Atlas & Stitch

You may have heard me drone on here and there about MongoDB Atlas and MongoDB Stitch. Previously, I hacked together an awful workflow that somehow utilized Tableau as an ETL tool to feed JIRA information into Mongo. I'd like to formally apologize for that entire series: I can't imagine there's a single soul on this planet interested in learning about all of those things simultaneously. Such hobbies reserved for masochists with blogging addictions. I apologize. Let's start over.

This is not a tutorial on how to use MongoDB: the database. I have zero interest cluttering the internet by reiterating what

Continue Reading
JavaScript
06 Oct 2018

Compile Frontend JavaScript with Babel and Gulp

Using ECMAScript functions on the frontend the quick and dirty way.
Compile Frontend JavaScript with Babel and Gulp

NOTE: This post has not aged particularly well. This is made evident by the presence of the word "Gulp" present throughout the post.


As you may have already deduced from the occasional glaring holes in my programming knowledge, I haven’t spent as much of my life programming than, well, anybody who haphazardly threw away an 8-year product management career. Apparently, a lot can happen in 8 years... especially when it comes to JavaScript.
Putting aside that whole server-side  NodeJS thing or whatever it’s called, there’s years worth of mindfucks for those of us who fairly recently returned

Continue Reading
NodeJS
28 Jun 2018

Upgrading to Gulp 4.0.0

Upgrading to Gulp 4 and tackling the breaking changes that come with it.
Upgrading to Gulp 4.0.0

Back in the day we touched on some of the wonderful upsides of implementing Gulp into your workflow. If you have been following along and happened to install the latest version of Gulp, you may has noticed something horrible happen: nothing worked. I probably should’ve mentioned that the latest major update to Gulp, Gulp 4, is actually a breaking update. That's my bad.

Strangely, documentation around upgrading from Gulp 3.X to Gulp 4 seems to be lagging way behind this release, with the closest thing to official documentation being some article a guy posted on Medium a while

Continue Reading
NodeJS
26 Jun 2018

Building Page Templates in ExpressJS With Handlebars

Building views in NodeJS by incorporating layouts, partials, and everything in between.
Building Page Templates in ExpressJS With Handlebars

Writing HTML sucks, thus we should do everything to minimize the time we spend writing it as much as possible.  Thus, we have Handlebars: a lightweight templating system for Node. Handlebars allows us to avoid repetitive code by compiling the final DOM structure of our site via logic, typically compiled by task runners such as Grunt or Gulp.

If you're involved in any sort of Node development, you're probably already familiar with Handlebars to a degree. I thought I was, but it isn't until we need to start a new project from scratch that we realize that we totally forgot

Continue Reading
NodeJS
22 Jun 2018

Read and Write to S3 Buckets via NodeJS

Node’s most popular package interacting with the most popular file store on the world’s most popular cloud.
Read and Write to S3 Buckets via NodeJS

We here at H+S are dedicated to one simple cause: creating posts about oddly specific programming scenarios. Somewhere in the world as sad soul is looking to programmatically access files from an S3 server while keeping their bucket private. To that person: we heard you.

There are plenty of reasons you'd want to access files in S3. For example, let's say you read that post about using Pandas in a Lambda function. Since you're already familiar with PyMySQL, you may hypothetically be in a position to export data from a DB query to a CSV saved in S3. I

Continue Reading
NodeJS
30 May 2018

Using Gulp: Tasks to Make Frontend Tolerable

Optimize your frontend code with Gulp: the task runner to make you production-ready.
Using Gulp: Tasks to Make Frontend Tolerable

NOTE:  This tutorial was written for Gulp versions <4.0.0. Check out this post for Gulp >4.0.0


Perhaps the whole obligatory-Gulp-tutorial on [Some Coding Blog] thing has become a bit cliché at this point. Haters may do as they will, but I 'll take any opportunity to jam as many SEO keywords I can get at this point. You know the ones: Gulp, ExpressJS, NodeJS, or perhaps even React Vue frontend Ubuntu framework API social cloud data entrepreneur community.

Regardless, we all need our own copy+paste references from time-to-time, or even worse: when we

Continue Reading
Frontend
25 Apr 2018

Make Your First API Calls with JQuery AJAX

Beginner's guide to consuming endpoints via Frontend Javascript.
Make Your First API Calls with JQuery AJAX

The information age is over: we have all the information now. All of it. We're in a unique place in human history where we've somehow managed to mine more data than we know what to do with... and a lot of that data is easily accessible via APIs.

We're going to get our feet wet with REST APIs today, thus allowing us to interact with meaningful information. Making Ajax GET calls with JQuery is perhaps as basic as it gets: there's a good chance we already know all this stuff, but even I constantly forget the exact syntax of everyday

Continue Reading