Skip to content

Instantly share code, notes, and snippets.

View aryanprince's full-sized avatar
🪄
Working Magic

Aryan Prince aryanprince

🪄
Working Magic
View GitHub Profile
@tailwiinder
tailwiinder / .cursorrules
Created April 27, 2025 09:26
cursorrules for using cursor as your AI coding tutor, enabling you to learn and discover programming concepts
- **Role**: Act as a coding tutor dedicated to helping me learn to code deeply and independently.
- **Code Writing**:
- Do not write complete code for me unless I explicitly request it.
- Instead, provide detailed explanations, hints, and partial solutions (e.g., pseudocode or code skeletons) to guide me in writing the code myself.
- **Teaching Approach**:
- Focus on teaching underlying concepts and first principles (e.g., for loops, explain iteration, its purpose, and how it controls flow).
- Break down complex topics into simpler, fundamental components.
- Connect new ideas to basic concepts I already know to build a strong foundation.
- **Nuanced Questions**:
- Suggest thought-provoking questions for me to research or ask back, such as:
@pontusab
pontusab / proximity-prefetch.tsx
Created April 6, 2025 06:43
Next.js Proximity Prefetch (PPF)
"use client";
import { useRouter } from "next/navigation";
import type { ReactNode } from "react";
import { useCallback, useEffect, useState } from "react";
interface ProximityPrefetchProps {
children: ReactNode;
threshold?: number;
predictionInterval?: number;
@t3dotgg
t3dotgg / try-catch.ts
Last active June 24, 2025 09:22
Theo's preferred way of handling try/catch in TypeScript
// Types for the result object with discriminated union
type Success<T> = {
data: T;
error: null;
};
type Failure<E> = {
data: null;
error: E;
};
@dhh
dhh / linux-setup.sh
Last active June 7, 2025 21:00
linux-setup.sh
# THIS LINUX SETUP SCRIPT HAS MORPHED INTO A WHOLE PROJECT: HTTPS://OMAKUB.ORG
# PLEASE CHECKOUT THAT PROJECT INSTEAD OF THIS OUTDATED SETUP SCRIPT.
#
#
# Libraries and infrastructure
sudo apt update -y
sudo apt install -y \
docker.io docker-buildx \
build-essential pkg-config autoconf bison rustc cargo clang \
"use client";
import {
Dialog,
DialogContent,
DialogTitle,
DialogTrigger
} from "@/components/ui/dialog";
import useDragDrop from "@/hooks/useDragDrop";
import { cn, formatBytes } from "@/lib/utils";
@iambryancs
iambryancs / pyenv-wsl-ubuntu_22.04.md
Created May 31, 2023 10:31
Using Pyenv in WSL Ubuntu 22.04 LTS to install Python 3.8

Using Pyenv in WSL Ubuntu 22.04 LTS to install Python 3.8

Env

  • Windows 10
  • Ubuntu 22.04 WSL
  • zsh

Requirements

  • git
@ciiqr
ciiqr / zod-optional-null.ts
Last active June 24, 2025 05:51
zod optional/nullable/nullish differences
// zod schema
z.object({
// valid if string or:
optional: z.string().optional(), // field not provided, or explicitly `undefined`
nullable: z.string().nullable(), // field explicitly `null`
nullish: z.string().nullish(), // field not provided, explicitly `null`, or explicitly `undefined`
});
// type
{
@TehBrian
TehBrian / final-cut-pro-trial-reset.sh
Last active June 21, 2025 07:22
Final Cut Pro Trial Reset
mv -vf ~/Library/Application\ Support/.ffuserdata ~/Library/Containers/com.apple.FinalCutTrial/Data/Library/Application\ Support/.ffuserdata ~/.Trash
@kurtmkurtm
kurtmkurtm / GitHub Action Test Publish
Last active November 7, 2022 01:02
Sample .NET Core GitHub actions workflow, with published markdown tests results using LiquidTestReports.Markdown - https://www.nuget.org/packages/LiquidTestReports.Markdown
name: .NET Core Build with Tests
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
@Beneboe
Beneboe / how-to-setup-verified-commits.md
Last active March 15, 2025 14:36
How to Setup Verified Commits on Github