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 / prettier-vscode-pnpm.md
Last active May 4, 2025 15:07
Prettier with VSCode and pnpm

When setting up prettier with vscode and pnpm, you need to make sure vscode uses local prettier instead of prettier from vscode extension.

You can do so by providing the prettier path in prettier.prettierPath settings which is usually ./node_modules/prettier.

But with pnpm the binary isn't located in node_modules by default. But you can set public-hoist-pattern[]=prettier in .npmrc and reinstall, so that pnpm installs prettier in node_modules.

import { RSCPolling } from "./rsc-polling";
export const DataFetcher = async () => {
const { status, data } = await getData();
if (status === "processing") {
return <RSCPolling interval={1000} />;
}
return <DataViewer data={data} />;
@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