How to Send Tweets With a JavaScript GitHub Action

GitHub actions is a feature which allows developers to construct workflows that run in response to various GitHub events. You can use them, for example, to run tests when a new pull request is received, post new issues to Slack, or publish a package to npm.

Previously, this kind of setup would have required a service such as Travis, or Circle CI. Actions however, are an official GitHub offering and give you first-class support for your automation needs.

In this article, I’m going to demonstrate how to create a GitHub action using JavaScript. This will post a tweet to Twitter every time a pull request is merged.

More …

setTimeout JavaScript Function: Guide with Examples

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

setTimeout is a native JavaScript function (although it can be used with a library such as jQuery, as we’ll see later on), which calls a function or executes a code snippet after a specified delay (in milliseconds). This might be useful if, for example, you wished to display a popup after a visitor has been browsing your page for a certain amount of time, or you want a short delay before removing a hover effect from an element (in case the user accidentally moused out).

More …

Make a Filterable Table With Vue.js

One of the things I love about Vue is its unobtrusive reactivity system. Models are plain JavaScript objects and when you modify them, Vue automatically updates a page’s HTML to reflect the change. This makes state management easy and intuitive.

In this tutorial, I’ll demonstrate how to leverage Vue’s reactivity to build a filterable table. This will only display the rows that match whatever text a user has entered into a text input. I’ll also show you how to highlight the matches.

This might be useful to help users quickly find what they are looking for in a long table. Once you have understood how it works, you can easily adapt it to lists or anything else you need to filter.

More …

Getting Started with NodeGUI

NodeGUI is an open source library for building cross-platform, native desktop applications with JavaScript and CSS-like styling.

In this article, I’m going to demonstrate how to get up and running with NodeGUI. We’ll set up a development environment, take a look at several of the library’s basic concepts, then finish off by creating a simple password generator app.

If you’re curious as to what we’ll end up with, the finished code can be found on GitHub.

More …

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 …