Changing the naming convention for Aurelia View Model class names
I was working on a large Aurelia project and having trouble with clashing names
of JS classes. The convention for Aurelia View Models is that their class names
CustomElement. But to prevent clashes, I wanted to ensure that View Models
attached to routes ended in
Route and components in
Component (e.g. an
EmailRoute might contain a
EmailComponent). I didn’t find a built-in way to
instruct the Aurelia loader to interpret class names this way, but it turned out
to be pretty easy to make an override:
@confirmUnload decorator for Aurelia route View Models
Aurelia custom attribute for Google Analytics events
@init / @waitOnInit TypeScript method decorators
@autocast TypeScript property decorator
@queuedOperation TypeScript method decorator
Instance-targeted TypeScript property decorators
Protractor: lessons learned
I’ve been working with Protractor a lot in recent monts, writing automated tests for the web UI of our company’s customer portal. In this post, I thought I’d share some of the lessons I’ve learned along the way, and give some practical advice.
Protractor custom locator: by.marker
Protractor makes it very easy to locate a specific element in your webapp for testing by writing CSS selectors. However, by using this overmuch, you’re locking your integration tests to the current structure of your app, making the tests fragile. Here’s a more robust alternative.
Jasmine custom matcher: toBeInstanceOf
Serving with ExpressJS in three quick steps
Say you have a couple of files that you want to serve for a while, and you happen to have Node installed on your box. Here’s three easy steps to serve the contents of a directory using Express.
Accessibility is fascinating!
Simple poller library in TypeScript
Here is a very simple library of pollers written in TypeScript. It uses async / await so if you want to transpile it to ES3 or ES5 you’ll need TypeScript 2.1 or higher.
Styling gists in Solarized Dark
I love the solarized color scheme, specifically Solarized Dark. When I set up this blog I wanted code snippets displayed the way they are in my editor: Solarized. Styling the highlighted stuff embedded in the post itself was easy: others had already written the CSS. Based on this, here’s what I used to style embedded gists on this blog.
@keyListener: a TypeScript keyboard event filter
Some notes on Accessibility
Here are some notes on the topic of accessibility that I took while researching the subject from the perspective of a developer.
Collecting translation keys during TypeScript build
I found myself in the position of building a lightweight i18n mechanism for the frontend of an enterprise app recently. I implemented a couple of decorators that inject translations into properties. I also extended the Gulp build process to gather all translation keys into a single file for me, which I could then use on the backend to deliver only the required translations, rather than send over the entire dictionary. Here’s how.
Deferred - A TypeScript Promise wrapper
Running the Glassfish pkg tool on 64 bit Ubuntu
The Glassfish Java application server comes with a number of tools, including
pkg is a 32 bit Python application and almost all of us
run 64 bit systems. So you need a couple of compatibility libraries to run the
tool. Here’s how you do that on Ubuntu 16.04.
Social share snippet for Jekyll
To set up this blog, I wrote a snippet of Jekyll template code (Liquid) to create social share links. You can find it on Github if you’re interested.
ttime: a critical shell trick
Angular vs React vs Aurelia
While working on my little checklist app
I needed a way to hard-wrap text entered into a
<textarea> and preserve the
linebreaks when copy-pasting it somewhere else. HTML and CSS don’t support this,
break on words whenever possible.
docker-gen: automatic nginx config with a human touch
In this article I will demonstrate a setup using Docker, docker-gen and nginx that will add new Docker containers to nginx automatically as an upstream instruction, but still let you manually configure how these containers are publicly served by writing the site instructions yourself.
Easy access to a dockerized mysql server
Which programming language?
I happened to come across this fine article today: “What Technology Should My Startup Use?” by Matt Aimonetti.
Update your projects: up.sh
I have a number of frameworks, platforms and reference projects in my workspace
that I want to update daily. Rather than going to each of them and doing
git pull by hand, I’ve written a little Bash script to do it for me. I just
keep a list of all projects I want updated. Now I need only run
./up.sh once a
suspend_until and suspend_for
Here are two Bash scripts I wrote some years ago that allow you to send your
computer to sleep for a specified time and then wake up automatically. They work
Renderable: simple template inheritance in PHP
Dokku and Docker on the same server: power and control
Setting up a secure public connection for a Docker daemon
I’ve posted about how to set up shipyard on your local machine. You can also use your local shipyard to manage your remote servers, but to do this you have to set up a secure connection to the Docker daemon on your server. Docker has an article which tells you how to do this. Since I’ve had to do it a couple of times over the last few days, I figured I’d make a bash script for the process.
Trying out Shipyard on your local machine
Note: this tutorial is outdated. Check shipyard-project.com for the latest installation instructions.