Skip to content

Instantly share code, notes, and snippets.

View kiritocode1's full-sized avatar
🪄
Abra Cadabra

Aryan Kathawale kiritocode1

🪄
Abra Cadabra
View GitHub Profile
@kiritocode1
kiritocode1 / P&C.cpp
Last active September 12, 2025 07:14
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
// Function to calculate factorial
long long factorial(int n) {
if (n <= 1) return 1;
long long result = 1;
@kiritocode1
kiritocode1 / Howto.md
Last active September 5, 2025 05:48
How to add Accessibility In any next app

1. Setup Next themes

https://www.npmjs.com/package/next-themes

2. once next themes is setup , test it out .... checkout a theme switcher , ask claude to make one for your next version .

3. Add this use-screen-reader.js hook , to a folder to use it in main component

@kiritocode1
kiritocode1 / somehowitworks.ts
Created August 16, 2025 18:50
somehowitworks.ts
import { Config, Console, Effect, Layer, Schema } from "effect";
import { Prompt } from "@effect/cli";
import { AiChat, AiTool, AiToolkit } from "@effect/ai";
import { AnthropicClient, AnthropicLanguageModel } from "@effect/ai-anthropic";
import { BunContext, BunRuntime } from "@effect/platform-bun";
import * as FetchHttpClient from "@effect/platform/FetchHttpClient";
import {OpenAiClient, OpenAiLanguageModel} from "@effect/ai-openai"
import { Effect ,Data} from "effect";
import { Schema } from "@effect/schema";
interface Todo{
id: number;
title: string;
}
const TodosSchema = Schema.Array(
Schema.Struct({
@kiritocode1
kiritocode1 / next-3d.tsx
Last active July 23, 2025 05:40
3d scene in VR
"use client";
import React, { useRef, useState, useMemo } from "react";
import { Canvas, useFrame } from "@react-three/fiber";
import { XR, VRButton, useXR, createXRStore } from "@react-three/xr";
import { OrbitControls, Text } from "@react-three/drei";
import { Mesh } from "three";
// Animated cube component
function AnimatedCube({ position, color = "orange" }: { position: [number, number, number]; color: string }) {
const meshRef = useRef<Mesh>(null);
// --- Day 9: Disk Fragmenter ---
// Another push of the button leaves you in the familiar hallways of some friendly amphipods! Good thing you each somehow got your own personal mini submarine. The Historians jet away in search of the Chief, mostly by driving directly into walls.
// While The Historians quickly figure out how to pilot these things, you notice an amphipod in the corner struggling with his computer. He's trying to make more contiguous free space by compacting all of the files, but his program isn't working; you offer to help.
// He shows you the disk map (your puzzle input) he's already generated. For example:
// 2333133121414131402
// The disk map uses a dense format to represent the layout of files and free space on the disk. The digits alternate between indicating the length of a file and the length of free space.
const Raw = `....h.....Q..............Y........................
...............................Y........C.........
...............m..........x................B......
........................Y..............qB.........
......g4.........................h..Y.....q...c...
................n.....R...........................
.......................................w........5.
// --- Day 7: Bridge Repair ---
// The Historians take you to a familiar rope bridge over a river in the middle of a jungle. The Chief isn't on this side of the bridge, though; maybe he's on the other side?
// When you go to cross the bridge, you notice a group of engineers trying to repair it. (Apparently, it breaks pretty frequently.) You won't be able to cross until it's fixed.
// You ask how long it'll take; the engineers tell you that it only needs final calibrations, but some young elephants were playing nearby and stole all the operators from their calibration equations! They could finish the calibrations if only someone could determine which test values could possibly be produced by placing any combination of operators into their calibration equations (your puzzle input).
// For example:
// --- Day 6: Guard Gallivant ---
// The Historians use their fancy device again, this time to whisk you all away to the North Pole prototype suit manufacturing lab... in the year 1518! It turns out that having direct access to history is very convenient for a group of historians.
// You still have to be careful of time paradoxes, and so it will be important to avoid anyone from 1518 while The Historians search for the Chief. Unfortunately, a single guard is patrolling this part of the lab.
// Maybe you can work out where the guard will go ahead of time so that The Historians can search safely?
// You start by making a map (your puzzle input) of the situation. For example:
// ....#.....
// --- Day 5: Print Queue ---
// Satisfied with their search on Ceres, the squadron of scholars suggests subsequently scanning the stationery stacks of sub-basement 17.
// The North Pole printing department is busier than ever this close to Christmas, and while The Historians continue their search of this historically significant facility, an Elf operating a very familiar printer beckons you over.
// The Elf must recognize you, because they waste no time explaining that the new sleigh launch safety manual updates won't print correctly. Failure to update the safety manuals would be dire indeed, so you offer your services.
// Safety protocols clearly indicate that new pages for the safety manuals must be printed in a very specific order. The notation X|Y means that if both page number X and page number Y are to be produced as part of an update, page number X must be printed at some point before page number Y.
// The Elf has for you both the page ordering rules and the pages to produce in each update (your p