Skip to content

Instantly share code, notes, and snippets.

View akshitkrnagpal's full-sized avatar
🏠
Working from home

Akshit Kr Nagpal akshitkrnagpal

🏠
Working from home
View GitHub Profile
@akshitkrnagpal
akshitkrnagpal / types.d.ts
Created February 22, 2023 00:48
Improve typesafety of your next/router
import { NextRouter } from "next/router";
declare module "next/router" {
export type Locale = "en" | "nl" | "de";
export function useRouter(): Omit<NextRouter, "locale" | "locales"> & {
locale: Locale;
locales: Locale[];
};
}
@akshitkrnagpal
akshitkrnagpal / CommaArrayParam.js
Created March 24, 2021 10:01
Custom Param for Array for serialize-query-params
import { encodeDelimitedArray, decodeDelimitedArray } from "serialize-query-params";
/** Uses a comma to delimit entries. e.g. ['a', 'b'] => qp?=a,b */
const CommaArrayParam = {
encode: array => {
if (!array || array.length === 0) return undefined;
return encodeDelimitedArray(array, ",");
},
decode: arrayStr => {
if (!arrayStr) return undefined;
@akshitkrnagpal
akshitkrnagpal / CSS for LED-like Animation.md
Last active February 15, 2020 06:44
CSS Animation for LED

CSS for LED-like Animation