Skip to content

Instantly share code, notes, and snippets.

View maneetgoyal's full-sized avatar
🎯
Focusing

Maneet Goyal maneetgoyal

🎯
Focusing
View GitHub Profile
@maneetgoyal
maneetgoyal / indian-districts-simplified.json
Created March 25, 2024 11:23
Indian Districts GeoJSON (Simplified)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@maneetgoyal
maneetgoyal / indian-districts.json
Created March 25, 2024 11:18
Indian Districts GeoJSON
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@maneetgoyal
maneetgoyal / merge.ts
Last active March 20, 2024 07:44
Merge CSV Files with same Column names and order
import { readdir, readFile, appendFile } from "fs/promises";
import { join } from "path";
export interface Progress {
type: string; // Progress type
timestamp: number;
percentage?: number;
message: string;
meta?: Record<string, unknown>;
isError?: boolean;
@maneetgoyal
maneetgoyal / multer-storage-engine.ts
Last active February 8, 2024 17:52
Multer Storage Engine in TypeScript
import { createWriteStream, unlink } from "fs";
import type { PathLike } from "fs";
import type { Request } from "express";
type Maybe<T> = T | null | undefined;
type ResponseCallback<T> = (err: Error | null, payload?: Maybe<T>) => void;
type RequestHandler<T> = (req: Request, file: Express.Multer.File, responseCb: ResponseCallback<T>) => void;
@maneetgoyal
maneetgoyal / webpack.config.js
Last active October 11, 2020 07:05
Externalize peerDependency in Webpack
function getPeerDependencies() {
const pkgPath = path.join(process.cwd(), "./package.json");
const pkgJSON = JSON.parse(readFileSync(pkgPath));
const peerDependencies =
pkgJSON.peerDependencies !== undefined
? Object.keys(pkgJSON.peerDependencies)
: [];
return peerDependencies;
}