Skip to content

Instantly share code, notes, and snippets.

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

Manav Misra manavm1990

🏠
Working from home
View GitHub Profile
@manavm1990
manavm1990 / renovate.json
Created September 21, 2024 12:50
My preferred RenovateBot starter configuration 🔧
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended"
],
"prHourlyLimit": 3,
"packageRules": [
{
"matchUpdateTypes": ["major"],
"dependencyDashboardApproval": true
@manavm1990
manavm1990 / tsconfig.json
Last active September 19, 2024 17:34
My Strict TS Config
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Base",
"compilerOptions": {
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": false,
"allowUnusedLabels": false,
"allowUnreachableCode": false,
"skipLibCheck": true,
"strict": true,
@manavm1990
manavm1990 / README.md
Created February 9, 2021 13:27
A 'template' for a README file for 'portfolio projects.' Based on 'Dev Challenges' format.
@manavm1990
manavm1990 / sample.md
Last active July 14, 2024 16:43
A 200-word sample for a News Writer position with Inside the Ropes

The Undertaker Reflects on Montreal Screwjob, Praises Bret Hart

In a recent episode of the podcast Six Feet Under with Mark Calaway, WWE legend The Undertaker shared his thoughts on the infamous Montreal Screwjob. He offered a unique perspective on the controversial incident that occurred during the 1997 Survivor Series.

The Undertaker acknowledged the unfortunate nature of the event. He stated, "As mad as I was about it... at the end of the day, I don't know that there was any choice." He emphasized the high-stakes nature of the 'Monday Night Wars.' He explained that WWE couldn't risk their champion appearing on rival World Championship Wrestling programming.

Despite the controversy, The Undertaker praised Bret Hart as "a really good friend" and lauded his in-ring abilities. He regretted that the Montreal Screwjob overshadows the careers of both Hart and Shawn Michaels.

The Deadman also revealed the impact Hart had on his career. He stated, "I grew

@manavm1990
manavm1990 / index.test.ts
Last active May 24, 2024 03:10
Removing timezone offsets before formatting/parsing date-time strings with `date-fns`, etc.
import { describe, expect, it } from "vitest";
import { removeTimezoneOffset } from ".";
describe("removeTimezoneOffset", () => {
it("should remove timezone offset in format -07:00", () => {
const dateTime = "2024-06-15T17:30:00-07:00";
const expected = "2024-06-15T17:30:00";
expect(removeTimezoneOffset(dateTime)).toBe(expected);
});
@manavm1990
manavm1990 / extensions.json
Created February 16, 2024 21:37
These settings and extensions are ideal for beginners working with basic Node programs in VS Code.
{
"recommendations": [
"aaron-bond.better-comments",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"mgmcdermott.vscode-language-babel",
"streetsidesoftware.code-spell-checker",
"usernamehw.errorlens",
"vivaxy.vscode-conventional-commits"
]

It's Me

@manavm1990
manavm1990 / isNotNullOrUndefinedOrEmpty.ts
Created December 6, 2023 06:19
If 1️⃣ is using TS in a strict sense, many errors/warnings regarding 'possibly null,' etc. can be resolved by using this utility fxn.
export function isNotNullOrUndefinedOrEmpty<T>(
value: T | null | undefined,
): value is T {
switch (true) {
case value === null || value === undefined:
return false;
case typeof value === 'string':
return value.trim() !== '';
case Array.isArray(value):
return value.length > 0;
@manavm1990
manavm1990 / index.ts
Created August 22, 2023 15:26
Sometimes, merging objects with spread results in TS losing its way with inferences. It starts to complain about potential `undefined`. You COULD use type assertions......
// Merges additional properties into an object, ensuring type consistency.
export const mergeProperties = <T, U>(
originalObject: T,
additionalProps: U,
): T & U => {
return { ...originalObject, ...additionalProps };
};
import { type ZodError } from 'zod';
export const stringifyZodError = (error: ZodError): string => {
return error.issues
.map((issue) => {
const path = issue.path.join('.');
const message = issue.message;
return `Currently facing issue with the field "${path}". ${message}`;
})
.join('\n');