All snippets

Handy code snippets you can copy and paste.

CSS line clamp

Limit the contents of a block container to the specified number of lines.

CSS

Fallback image component

Replace broken image links with a placeholder with Next.js image.

Next.js

React

Filter object for allowed keys

Remove unwanted keys and values from a JavaScript object.

JavaScript

Abbreviate number

Shorten a number like 34,000 to 34K.

JavaScript

Combine CSS classes

Combine CSS classes for easy dynamic styling.

JavaScript

CSS

Convert time

Convert a date to a readable format.

JavaScript

Empty object

Check if an object is empty.

JavaScript