Skip to content

Snippet

A collection of helpful snippets to help you, including myself to spin up the development. Remember, Do Not Repeat Yourself.

Explore Them

Axios HTTP Go Style

Make your HTTP request simple by using GO style in JavaScript

See snippet Axios HTTP Go Style

Read Your Mdx Files

Most dev use MDX as their storage to store content such as blog, well this site use mdx too, this snippet useful to read mdx files

See snippet Read Your Mdx Files

Simple function to works with base64 encoding

This is simple function, it useful for base64 encoding

See snippet Simple function to works with base64 encoding

Check value exists in array

check is object value is exists in array

See snippet Check value exists in array

useToggle

Toggle boolean made easy with hooks

See snippet useToggle

Observe Your HTML Element

Check whatever HTML element in viewport

See snippet Observe Your HTML Element

Goroutine with Golang

Make multithreading program using goroutine

See snippet Goroutine with Golang

Modern Unique Array

get distinct values from an array of objects in JavaScript with modern solution

See snippet Modern Unique Array

useArray

Array function made simple

See snippet useArray

Do Not Run First Mount

Prevent Side Effect to run when component did first mount, but when the next state changes, do something

See snippet Do Not Run First Mount

useLocalStorage

Store a data to browser local storage using this hooks

See snippet useLocalStorage

Invalid Input Shake Animation

Simple shake animation when invalid input, very helpful for form validation

See snippet Invalid Input Shake Animation

useClickOutside

Click outside element and run a callback, very helpful for element like dropdown

See snippet useClickOutside

useKeyPressEnter

Hooks to help creating key press handler

See snippet useKeyPressEnter

useWindowScrollPosition

Get window scroll position of Y axis or X axis

See snippet useWindowScrollPosition