Articles

This site can’t provide a secure connection

Developing on localhost without https? It may happen, but Chromium-based browsers and Firefox will force you periodically to use https connection. And then you reload the page and see:

This site can’t provide a secure connection

At this point you won’t be able to use your localhost. However, here is the solution that will help.

  1. Open chrome://net-internals/#hsts
  2. Go to Delete domain security policies
  3. Type your domain, e.g. example.com and activate Delete
hsts settings

[……]

Read more

Error: Package subpath ‘./package.json’ is not defined by “exports”

Got Error: Package subpath './package.json' is not defined by "exports" issue? You may take following steps (one of them):

  1. Ask npm package author to fix the issue. However, sometimes it may not be possible. Then step #2.
  2. Downgrade your NodeJS to version lower than 17. Find NodeJS releases. I’d recommend to use Node Version Manager (nvm) for that purpose.

[……]

Read more

zsh compinit: insecure directories, run compaudit for list.

I’ve installed nvm through brew on macOS Big Sur 11.2.3 (20D91) and got:

zsh compinit: insecure directories, run compaudit for list.
Ignore insecure directories and continue [y] or abort compinit [n]?

After research seems I had to update all files/folders with correct permissions using:

compaudit | xargs chmod g-w

Note that sudo is not needed here as long as the file belongs to root.[……]

Read more

Stop using logical NOT ! and casting using double exclamation mark !! in JavaScript / TypeScript

A word of introduction

Exclamation mark ! is the logical NOT (!) operator (logical complement, negation) that takes truth to falsity and vice versa. Double exclamation mark !! is the logical NOT NOT (!!)

In JavaScript, the values false, null, undefined, 0, -0, NaN, and '' (empty string) are “falsy” values. All other values are “truthy”. See: ECMAScript 2019 7.1.2 ToBoolean.

Below table provides details of how ! and !! applied to various values:

! and !! applied to various values

value!value!!value

false
true
false[……]

Read more

zsh: command not found: wget (MacOS)

When you try to use wget on MacOS (at least Big Sur) then you may get an error message zsh: command not found: wget. You can resolve it by simply installing wget using brew.

brew install wget

Then the console messages should show more or less:

==> Downloading https://homebrew.bintray.com/bottles/wget-1.21.1.big_sur.bottle.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/e6ea2a50b8196206f7072360e713535bb16fb786c8b5fe23cab05757e0f67b13?respo
######################################################################## 100.0%[......]

Read more

Generate background CSS rule with SVG as data URI using Sass

Highly likely you’ve heard of data URIs. It’s a way of including a resource inside your CSS. No extra separate HTTP request is then needed. The format that you use in a data URI can vary. Essentially you just tell it what content type it is (e.g. image/png), semicolon, then the data of that file.

Using svg as a background is great. However, preparing base64 encoded data to embed svg inside your CSS is a bit tricky. I have used Sass for that purpose thanks to https://gist.github.com/rniswonger/c4cf85fbbd50c5be4cbb7bd8087dc388. Here is the cod[……]

Read more

Adding Tags in Google Tag Manager and blocking trackers

Today’s day quite a lot of users are using different solutions to keep their privacy on a good level. However, that means that when the page is loaded some content will never be loaded as they are being blocked by ad/trackers blockers.

So, if you’re using Google Tag Manager and add tags then everything that is being triggered there will not work when Google Tag Manager will be blocked.

For example, using Brave browser Google Tag Manager is blocked by default. See:

Brave Browser cross-site trackers blocked

I’d recommend to check if you need to trigger anything inside Google[……]

Read more

Pagination