javascript

Posts

Extends Express session SessionData type

Express Session allows to store a lot of different data. There is a Typescript type named `SessionData` which allow to know what contains a session but not the data you will defined after without defining them.

Keep the same Node.js version between local environment and Github Actions

It can be complicated to have the same Node version between the local environment and the CI/CD. The latest Node.js version or the latest lts is released recently and if you want to upgrade to the Node version, usually you can forget to configure one environment.

Convert a JavaScript object to queryparams string

This post describes two very simple ways to convert a JavaScript object to a querystring both in a browser environment or server environment.

ESLint Global Variables

When we use some global variables defined elsewhere, eslint throws an error saying the variable is not defined. Here is how to configure eslint to ignore those.

Extend Window type with Typescript

Some of the object properties or functions are not available in the Typescript Window type. Let see a way to extend the Window type with the missing properties.

Gatsby + Netlify CMS + TailwindCSS Starter

Just created a new starter coming from some of my website development and powered with Gatsby.

How to get a React element as an HTML string

For use cases, you may want to have the generated HTML string from your React component instead of a mounted component rendered on the page. The simplest way is to use the renderToString function provided by the react-dom package.

How to manage Internationalization with NextJS SSG

Staticaly generating a website with the NextJS framework in different languages is not so obvious.

How to render emojis with JavaScript

For the content of your posts, emojis add some fun to your pages. This short post explains how to make that possible in JavaScript.

Update NodeJS with npm

New NodeJS releases are done often, so you need to keep your installation up to date. To do so, you can use your Linux distribution package manager (apt, dnf, ...) or brew for OSX. Another way is to use npm..

Snippets

Create layout with HandlebarsJS

Layout template is a good practice to not repeat ourselves (DRY). Handlebars templates engine does not provide a layout feature out of the box but it still is possible to create a layout. principle. Handlebars template engine, there is no out-of-the-box layout feature but it is possible to create a layout.

Create layout with HandlebarsJS

NestJS Project Dockerfile

A Dockerfile to build production-ready NestJS app docker image.

NestJS Project Dockerfile

Typescript Project Dockerfile

A Dockerfile to build production-ready Typescript docker image.

Typescript Project Dockerfile

Rename the extension of multiple files with bash script on Mac and Linux

A bash script snippet to rename recursively multiples files extension from the current directory.

Rename the extension of multiple files with bash script on Mac and Linux