A Guide to the Pug HTML Template Preprocessor

This article was first published on SitePoint and has been republished here with permission.

As web designers or developers, we likely all have to write our fair share of HTML. And while this is not the most difficult task, it can often feel a little boring or repetitive. HTML is also static, which means that if you want to display dynamic data (fetched from an API, for example), you invariably end up with a mishmash of HTML stings inside JavaScript. This can be a nightmare to debug and to maintain.

This is where Pug comes in.

More …

A Beginner's Guide to Installing a Custom ROM on an Android Phone

I have an old Sony XPeria S phone (from 2012) which has long since been abandoned by my carrier. It no longer receives any updates and is stuck on Android 4.2, which kinda sucks….

So I decided to take matters into my own hands and get an up-to-date version of Android, by flashing the phone with a custom ROM. While this didn’t prove to be that difficult, I did hit a few stumbling blocks along the way, which I wanted to document.

This post will serve two purposes. Firstly, it will provide detailed instructions on how to install a custom ROM on an Xperia S. Secondly, it will also outline the general process of flashing an old Android phone and offer a high-level overview of the concepts involved.

More …

How to Update Phusion Passenger When Installed via RubyGems

Pair of feet sticking out of a car window
Photo by Erik Odiin on Unsplash

Phusion Passenger (a.k.a. mod_rails) is a module for the Apache HTTP Server which can (among other things) be used to deploy Rails apps.

As with any piece of software, from time to time security vulnerabilities will be discovered and Passenger will need to be updated.

Although the project’s homepage offers some excellent documentation on how to do this, the steps they describe didn’t work for me and resulted in my app crashing.

Inspecting the Apache error logs informed me that a segmentation fault had occurred and that I may have encountered a bug in the Ruby interpreter. This was accompanied by a 5,000 line stack trace.

Oh dear!

More …

Quick-Tip: Show Modal Popup after Time Delay

This article was first published on SitePoint and has been republished here with permission.

In the following quick tip, I’m going to show you how to open a modal window on a web page after a short time deay. This might be useful to highlight a particular call to action, such as signing up for a newsletter or for getting likes on Facebook. Some sites also use this technique to display advertising.

More …

Quick Tip: Persist Checkbox Checked State after Page Reload

This article was first published on SitePoint and has been republished here with permission.

This quick tip describes how to have your browser remember the state of checkboxes once a page has been refreshed or a user navigates away from your site to come back at a later date.

It might be useful to persist checkbox checked state if, for example, you use checkboxes to allow your users to set site-specific preferences, such as opening external links in a new window or hiding certain page elements.

More …

How to Set Up an Apache Virtual Host on Linux Mint

Running Apache on my local machine helps me speed up my web development work. It means that I can use root-relative urls, server-side programming languages (such as PHP) and interface with a database — all without having to upload anything via FTP.

The only problem comes when you are working on multiple projects at the same time. If you create different directories for different projects within your web root (which defaults to /var/www/html), then the root-relative urls will break, as will any server-side includes you are using.

This is where virtual hosts come in. They allow you to create a separate domain for each of your projects, such as http://project1/ and http://project2/.

More …

How to Install rbenv on Linux Mint 17.1

Last year I wrote about installing rbenv on Linux Mint 16. Back then the installation process as described on the project’s Github page didn’t work for me and, after much frustration, I ended up installing an older version of rbenv from the repositories.

Recently, I had to reinstall my operating system (upgrading to Mint 17.1) and decided to give the rbenv installation process another try. I’m happy to say that it worked entirely as expected and within a matter of minutes I had two Ruby versions installed on my system and could switch between them at will.

More …