When I tried to use unistore instead of redux in one of my pet projects, I discovered that its TypeScript typings are not very accurate. In this post I try to come up with better typings for unistore’s connect() function.
There may be a situation where you need to mock methods or properties on window.location in Jest. However, because of peculiarities of jsdom, this could be challenging. In this post there is one of the possible solutions to this problem.
When using sass-loader 8.0.0 with preact-cli 3.0.0-next.19,
preact build fails with an error: Invalid options object. Sass Loader has been initialised using an options object that does not match the API schema. options has an unknown property ‘includePaths’. Quick fix: use sass-loader 7.3.1.
Sometimes you may need to integrate
debug with a high performance logger, such as
pino. And of course, there is an NPM package for that:
pino-debug. However, if you look at its source code, you will find out that it uses undocumented dirty hacks, which, in my opinion, make it quite fragile. This article demonstrates a much simpler solution.
I once had to work with a project which used MariaDB connector for Node.js, and for some reasons it was necessary to add Knex query builder to it. The main issue was that Knex supports only a few drivers, and MariaDB is unfortunately not one of them. I had to write a MariaDB client for Knex myself, and that was surprisingly easy.
A simple addon for Node.js that provides bindings to inet_ntop() and inet_pton() functions
This post describes how to serialize a FormData object to JSON and how to fill the form back with the serialized data.
When you go to the Dashboard of your WordPress site, WordPress checks whether your browser is up-to-date, and displays a notice if it is not. However, the browser check is performed by an external site. WP sends such data as: visitor’s user agent string, WordPress version, and the URL of the blog (and, implicitly, its IP address). Unfortunately, there is no way to opt out of that in the Dashboard. Luckily, there is a solution.
By default, WordPress allows an unauthenticated user to view the list of the registered users with the help of the REST API. But, for example, to view the list of the users in the Dashboard, the user needs to have
list_users capability (that is, be an Administrator). While the REST API does not expose sensitive information (such as emails) to unauthenticated users, it may be desirable to restrict
users endpoint form unauthenticated users.
We live in a world where data is an incredibly valuable currency, and you are always at risk of loss. Because of this, you must do everything you can to ensure what you hold on your desktops and servers is safe. If you are looking to lock down your Linux servers and desktops as tight as possible, you should consider to make use of two-factor authentication. This article explains how to configure two factor authentication using pam_u2f.