Posts List

Node.js Job Scheduling with Agenda

I have a freelance project I’ve been working on that needed to be setup to allow tasks to be retried automatically. The application depends upon an integration between two 3rd-party systems, and those systems only sync up at certain intervals. If one system didn’t have the information I needed to wait until it did. So I started looking at different scheduling and queueing systems to see if something already existed that would work for my situation.

Server-Sent Events With Node

Server-Sent Events (SSEs) allow one-way communication from the server to the client. They can be very useful for things like notifications or activity feeds. I’ve recently used them in a project to display output from a background process in the browser. In the browser, you connect to the server using the EventSource interface and just add event listeners. It is really very easy. const sseSource = new EventSource('/event-stream'); sseSource.addEventListener('message', (e) => { const messageData = e.

String Length & Bytes In JavaScript

In most cases, you can assume one character in a string is 1 byte, but that is only in most cases. How many bytes do you think ü is? It turns out it is 2 bytes. But if you run 'ü'.length it will return the string’s length as 1. Unicode characters can appear as a single character but be made up of multiple bytes of data. Usually, this isn’t a big deal if you just need the length of a string, but if you actually need the size in bytes of a string it is a big deal.

Restarting Your Node App After Changes

A nice feature of tools like create-react-app, angular-cli, webpack, and many others is the ability to reload your application when you make a change to a source file. But what do you do when you have a Node backend to go along with your frontend? There are numerous tools you can use to detect changes to files and then restart a process based on that, but who has time to build those scripts to put it all together?

Bootstrap v4 Responsive Navbars without jQuery

I’ve been using Bootstrap v4 in a project I am working on for a friend. He wants to be able to use the application on a mobile phone. Since I used Bootstrap’s navbar, I was going to need Bootstrap’s collapse javascript code. That code depends upon jQuery, and that is an issue for me. So I decided I would write some code that would perform the same basic function as Bootstraps, but not use jQuery at all.

Bootstrap Lightbox Update

I took a bit of a break from working on Bootstrap Lightbox. I just needed to get away and be lazy for a while, but I am back. The other week I re-wrote the whole thing again. I’m sure that gets tiring for some, but I had several reasons: I wanted to do a little as necessary as Twitter updates Bootstrap I wanted Bootstrap Lightbox to focus on images I needed more JavaScript practice So, here is what is going on.