Skip to content

Instantly share code, notes, and snippets.

View ng-hai's full-sized avatar

Hai Nguyen ng-hai

View GitHub Profile
@ng-hai
ng-hai / History|-10342dd|entries.json
Last active February 13, 2023 04:03
Visual Studio Code Settings Sync Gist
{"version":1,"resource":"file:///Users/hai/Code/github.com/ng-hai/justwrite.day/app/head.tsx","entries":[{"id":"5siX.tsx","timestamp":1667624224958},{"id":"zbYc.tsx","timestamp":1668322748963}]}
@ng-hai
ng-hai / vietnamese-accents-removal.js
Last active November 27, 2019 09:09
Vietnamese accents removal
const ACCENT_MAP = {
ó: 'o',
ò: 'o',
ỏ: 'o',
õ: 'o',
ọ: 'o',
ơ: 'o',
ớ: 'o',
ờ: 'o',
ở: 'o',
@ng-hai
ng-hai / phone-validation.js
Last active December 7, 2020 10:44
Vietnamese mobile phone number validation
const COUNTRY_DIALING_CODE = "84"
const NETWORKS_PREFIX = [
// Viettel
"32",
"33",
"34",
"35",
"36",
"37",
@ng-hai
ng-hai / nprogress.js
Last active January 17, 2021 05:36
My smoothly config for `nprogress` with `next/router` and use as a component
import Router from "next/router"
import Nprogress from "nprogress"
Nprogress.configure({ showSpinner: false, minimum: 0.01, easing: "linear" })
let timeout
let timer
function startProgress() {
// Only start the progress if the site takes too long to load