This is my humble collection of code pieces and snippets that I have found interesting or handy at some point in my work, or maybe just don't see any reason to remember it. Use tags and filters to find what you are interested in.

DOM: Traverse and manipulate

A short reminder about ways to traverse and manipulate DOM elements.

DOM

Optional chaining (?.)

The ?. operator is like the . chaining operator, except that instead of causing an error if a reference is nullish (null or undefined), the expression short-circuits with a return value of undefined.

JS

Nullish coalescing operator (??)

It returns its right-hand side operand when its left-hand side operand is null or undefined, and otherwise returns its left-hand side operand. Good to set up backup value in case of invalid main value.

JS

Console methods for better logging

Consider being neat pure greatly house something visit weather agreed saved be talking warmly offer want. Consider being neat pure greatly house something visit weather agreed saved be talking warmly offer want.

Console

JS

Express server boilerplate

Express.js basic server boilerplate with mongoose, Body parser and EJS included.

Express.js

Node.js

Boilerplate

getStaticProps & getStaticPaths

2 important functions of Next.js are meant for a server-side generation. Here is an example of how to use it.

Next.js

GraphQL

Apollo client for GraphQL

Client to use with Next.js for queries to GraphQL API

GraphQL

Next.js

Focus state for a From

A bit of code to manage focus state in a form with multiple fields

Vanilla JS

Forms

Remove all “falsy” values from an Array

Filtering for Boolean will remove all 'null' and 'undefined'

Vanilla JS