Skip to content

Instantly share code, notes, and snippets.

View growupanand's full-sized avatar
🎯
Building ConvoForm.com

UTKARSH ANAND growupanand

🎯
Building ConvoForm.com
View GitHub Profile
@growupanand
growupanand / rfc-template.md
Created June 25, 2024 10:56 — forked from michaelcurry/rfc-template.md
RFC Template [Markdown]

RFC Template

Feature Name: (fill me in with a unique identity, myawesomefeature)

Type: (feature, enhancement)

Start Date: (fill me in with today's date, YYYY-MM-DD)

Author: (your names)

@growupanand
growupanand / route.ts
Created January 28, 2024 15:50 — forked from mkcode/route.ts
How to setup Next App Router + Clerk + TRPC
// TRPC API endpoint
// src/app/api/trpc/[trpc]/route.ts
import { fetchRequestHandler } from "@trpc/server/adapters/fetch";
import { type NextRequest } from "next/server";
import { env } from "~/env";
import { appRouter } from "~/server/api/root";
import { createTRPCContext } from "~/server/api/trpc";
import { getAuth } from "@clerk/nextjs/server";
@growupanand
growupanand / ReactSuspenseComponent.js
Last active January 23, 2024 17:36
Snippet of React Suspense component, which can be used to show fallback UI while a component loading data
import { Suspense } from "react";
export const fakeTimeout = (ms) => {
return new Promise((resolve) => setTimeout(resolve, ms));
};
const wrapPromise = (promise) => {
let status = "pending";
let result = "";
let suspender = promise.then(
@growupanand
growupanand / fakeAwait.js
Created December 23, 2023 20:01
Fake async await in javascript
function timeout(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
@growupanand
growupanand / main.dart
Created December 12, 2023 08:21
In flutter, Check if virtual keyboard is open
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
@growupanand
growupanand / notificationStore.tsx
Created June 27, 2023 16:33
This code snippet implements a notification store using React.js and Zustand. It provides a convenient way to manage and display different types of notifications (success, error, info, warning, loading) in a React application.
import {notifications as mantineNotifications} from '@mantine/notifications';
import {IconCheck, IconExclamationMark, IconInfoCircle, IconX} from '@tabler/icons-react';
import {create} from 'zustand';
const NotificationTypeColors = {
error: 'red',
info: 'blue',
success: 'green',
warning: 'yellow',
loading: 'blue',