Configure an infrared remote control with Linux

Introduction

Recently I bought a shiny new Intel NUC8i7HNK, equipped with 16 GB of RAM and a 500 GB SSD and I installed Ubuntu 18.04 LTS. I have to say that it works smoothly and my overall experience with it is really positive this far. I don’t really miss the MAC or Windows at all.

The Intel NUC8i7HNK comes with many different expansion options and among these, there is a front consumer infrared (CIR) sensor, so I asked myself if it was possible to control the NUC with a …

Read More
Get the full path of a File using the Storage facade on Laravel

Introduction

This post is just a reference for the various ways of retrieving the full path of a file using the Storage facade in Laravel.

Under the hood the Storage facade it uses the Flysystem PHP Package by Frank de Jonge, allowing the developer to use the same API with different filesystem drivers (Local, SFTP, Amazon S3, Rackspace and so on).

In this post I’m interested in getting the full path of a file. I will use the local driver, whose methods are relative to the …

Read More
Nullable objects using JavaScript proxies

Introduction

JavaScript proxies are an ES6 (aka ES2015) feature that lets you wrap an existing object and intercept any access to its attributes or methods, even if they do not exist.

var proxy = new Proxy({ name: "John Doe" }, {
    get: function(target, property) {
        if (property in target) {
            return target[property];
        } else {
            return "Nope!";
        }
    }
});

console.log(proxy.age);         // "Nope!"
console.log( …
Read More
Handling breadcrumbs with VueX in a VueJS Single Page Application

Introduction

At work we are building a complex Single Page Application with VueJS, VueX and VueRouter. As soon as it started to get bigger we found the need to add breadcrumbs to the main interface, in order to indicate to the user exactly where he/she is and to provide an effective navigation mechanism.

At first we searched for existing solutions and libraries, however we only found bits of inspiration, but nothing really ready to use, so we decided to roll out our own solution …

Read More
Manage content in a ProcessWire website using Telegram

Introduction

In this tutorial we will learn how to manage content in a ProcessWire website using a Telegram bot.

Today responsive bots are on everyone’s mouth, so I decided to take a deep dive into this new (at least for me) world to learn something new, but also to build something useful using my favourite CMS.

Notice: If you don’t where to start with ProcessWire, I suggest you to look at my 4-part series “How to build a basic webiste with ProcessWire”. …

Read More
Remove duplicate rows from MySQL table

Introduction

Suppose that we have a MySQL table with the following fields:

SHOW COLUMNS FROM survey_responses;

---------------------------------------------------------------------------------------------------------
| id (PK) | survey_id (FK) | page_id (FK) | question_id (FK) | option_id (FK) | session_id (FK) | value |
---------------------------------------------------------------------------------------------------------

You don’t need a lot of context, you just need to …

Read More