Posts

How To Deploy Aurelia 2 Apps To GitHub Pages (gh-pages)

You have yourself an Aurelia app (or you will soon), and you want to host it on GitHub Pages because GitHub provides a generous free hosting solution that gets powered from the Git repository itself. Fortunately, the process couldn’t be more straightforward. A lot of this post will apply to other frameworks and libraries besides Aurelia 2. However, we will be focusing on Aurelia 2 only. This article assumes the following:

Fixing The Certbot Issue "The client lacks sufficient authorization/404 Not Found..."

I am a huge fan of Let’s Encrypt and their free SSL certificate service using Certbot. However, recently whilst setting up a new domain name and attempting to get a certificate, I encountered an error I had never experienced before. The client lacks sufficient authorization :: The key authorization file from the server did not match this challenge It couldn’t access the folder where it stored the secrets and was resulting in a 404 error. I manually created the folder and I could access it, so why Certbot couldn’t was a mystery.

Ditching Travis CI For GitHub Actions

I have been using Travis CI for my continuous workflow needs for a very long time now. It does what it does and it does it well. However, Travis is an additional service you have to configure and login to, it is a bit disjointed from the code itself. When GitHub announced Actions, it was a game-changer. Essentially, it was Travis CI embedded into GitHub itself. Over time, the community have run with GitHub Actions and now there are numerous “recipes” to do tasks inside of your actions.

How To Generate An SSH Key and Add The Public Key To A Remote Server

The thing with SSH authentication is I can never remember the steps to generate an SSH key, and then add that SSH public key to the remote server so SSH authentication works. I had all of this in a text file, but honestly, I reference my own blog for knowledge on how to do things all of the time, I thought I’d write up a quick post. You can find numerous blog posts on this, but I always seem to find a straightforward explanation to give me what I need, that I just consulted my text file on my desktop.

How To Add Feature Flags Into Your Javascript Applications

Feature flags are a great way to prevent stale branches by regularly shipping features in your code without officially enabling them. A feature flag let’s you turn code on and off, in the case of features, a feature flag means you can regularly merge branches and release them. While there are many different ways you can approach this, one of my favourite and most simple approaches is a features.json file in your application.

How To Do Prepared Statement LIKE With SQLlite 3 and The Better SQLite 3 Package

I love SQLite and I am using it in my Aurelia 2 book for the server aspect to provide users with a real server backed by a database. I am using the equally brilliant Better SQLite 3 library which allows you to work with SQLite 3 databases in a performant and easy way. This is how I did a prepared statement for my LIKE query which searched products by title in my database. The statement itself needs LIKE ? and then on the all method we provide the argument.

How To Get Last 4 Digits of A Credit Card Number in Javascript

Recently whilst working on my Aurelia 2 book, for the example application where you checkout I needed to add in the ability to provide a card number and when it saves, the last 4 digits of the card number get saved. This is one of those things that as developers we won’t do too often, but it’s easy using substr to trim a text string to a certain length. let ccNumber = '4560265043620583'; let lastFourDigits = ccNumber.substr(-4); By providing -4 as the value to substr you’re telling it to take the last 4 characters from the string. The result from our example will be 0583. You can also provide non-negative numbers to go from the beginning as well.

Announcing The Aurelia 2 Book

Buy the Aurelia 2 book here. With the Aurelia 2 alpha coming very shortly, I have had plans for a while to write another Aurelia book, this time around on Aurelia 2. I learned a lot writing my first book and admittedly, made a few mistakes. The learning experience was invaluable. With my first book, it came at a time when the Aurelia documentation was subpar. The book served as more of a stand-in for the lack of detailed and concise documentation. With Aurelia 2, extensive documentation work has been undertaken to the point where a book telling you about every little thing makes no sense.

Level Up Aurelia Store With pluck and distinctUntilChanged

Aurelia Store is a powerful state management library for your Aurelia applications, but behind-the-scenes it merely wraps the powerful RxJS observable library. This means you can use a plethora of RxJS methods to change how Aurelia Store works. Problem: Aurelia Store will fire all state subscribers regardless of change Whenever your state changes, all listeners of the state object will be fired. While smaller applications won’t introduce any noticeable differences, as your application grows in size and complexity, depending on what you’re doing inside of those store subscribers you can run into some issues.

How To Fix HiveJS AssertionError "Expected version 128, instead got 149" and "Expected version 128, instead got 38"

If you are trying to use any methods in the HiveJS client which require the use of a private key, you might have encountered one or both of these errors. In my case, I was using the memo encode method which takes a private key as the first argument, unfortunately, pass it the wrong key and you’ll get a non-helpful AssertionError about an expected version. You’re seeing the error because you’re providing the wrong key. If you get the error, “AssertionError: Expected version 128, instead got 38” it means you are trying to use a public key when you need to use a private key.