A PHP engineer working with Node.js

Most of the software projects I engaged in during my career had PHP as their main programming language. Yet, I also had the opportunity to work with other stacks. One of these times I developed the backend of a waterway monitoring app using Node.js. The main purpose of the app was to provide relevant data …

Installing Composer v1 in a CircleCI build

Composer v2 has been released for a while now, however some older projects still might rely on its previous major version. When using the official images from CircleCI to build a project, you’ll probably get the latest version of Composer installed. If that’s causing a build to break, it’s possible to downgrade Composer by adding …

Add Bootstrap styles to a project without Webpack

The directions below are not only applicable to Bootstrap but to any SASS-based framework or library. Introduction I started working on a small project that compiles to a small set of static HTML+CSS. Since I don’t have any Javascript in it, using Webpack didn’t look the right way to include the Bootstrap files I wanted. …

Avoiding state update on unmounted React component within useEffect hook

The hooks introduced with React 16.8 are a nice way to control state and other features on functional React components. They discard the necessity of third-party libraries such as Recompose – which is the inspiration for React hooks, by the way. One way one can apply the useEffect hook, for example, is to mimic the …

Custom setters with React useState hook

One of the recent additions to React was its hooks. With that, developers don’t need to rely on libraries such as Recompose to add state (and other features) to functional components. If you’re one of those devs and were used to create custom setters for states, it’s possible you find the new useState hook somewhat …

Checking DNS records of a specific nameserver

I’m migrating a site from GoDaddy to HostGator (I personally would prefer to move over AWS but that’s the client’s choice in this specific case) and I wanted to get the IP of the new server on HostGator. I couldn’t find the IP anywhere on their control panel. Pinging the temporary URL they provide for …

Laravel and NodeJS messaging using Redis Pub/Sub

I was recently working on this project that was composed of two different parts: a web application built in PHP with Laravel, and an AWS Lambda function written in NodeJS. In the past, both applications exchanged data using a common MySQL database. With time, this setup showed up very inefficient. As the number of “messages” sent and …

Using MutationObserver API and undo.js to track DOM changes

I was recently working on this project that had a kind of drag and drop builder. Users should be able to drag items into a specific building area to assembly stuff — I’m sorry for not giving more details, by the time I’m writing this the product is not yet released. One of the features I …

Testing Stripe webhooks when using Laravel Cashier

I’m not sure why this is not in the docs, but if you’re using Laravel Cashier and want to test Stripe webhooks – in test, not live, mode – you have to set the following env var: CASHIER_ENV=testing I’ve spent some time checking around my code until I found that.