Skip to content

Instantly share code, notes, and snippets.

@amit08255
amit08255 / html-otp-input.html
Created November 13, 2025 18:19
HTML OTP Input
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Verify Your Account</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
background: #f5f5f5;
@amit08255
amit08255 / svg-dark-light.html
Last active November 12, 2025 14:59
SVG Dark Light Themed Color
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="color-scheme" content="light dark" />
<title>SVG Dark Mode - Real light-dark() CSS</title>
<style>
:root {
color-scheme: light dark;
@amit08255
amit08255 / chrome-debug-trace-origin.html
Created November 3, 2025 18:22
Chrome debug trace origin of an object
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Chrome DevTools - Real Object Tracing Demo</title>
<style>
* {
margin: 0;
padding: 0;
@amit08255
amit08255 / demo1.html
Created October 1, 2025 03:37
CSS container queries demo
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Advanced CSS Container Queries Demo</title>
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<style>
body {
background: #f6f7fb;
font-family: system-ui, sans-serif;
@amit08255
amit08255 / 1-2-App.jsx
Created September 29, 2025 03:47
This Little-Known JavaScript API Changes How We Handle Async States Across Threads
// App.jsx
import { AtomicState, useAtomicValue } from "./shared-atomic-state";
import './App.css';
// Create a shared state instance (could be moved to a context or module)
const atomicState = new AtomicState();
// Create two atomic values
const counterA = atomicState.createAtomicValue(0, "int");
@amit08255
amit08255 / App.jsx
Created September 29, 2025 02:39
React Worker + OffscreenCanvas for Performant UI
import React, { useState } from 'react';
import { MapCanvas } from './components/MapCanvas.jsx';
import { HeatmapControls } from './components/HeatmapControls.jsx';
function App() {
const [region, setRegion] = useState('NYC');
const [zoom, setZoom] = useState(12);
const [heatmapOptions, setHeatmapOptions] = useState({
radius: 20,
@amit08255
amit08255 / react-app-event-bus.tsx
Created September 22, 2025 16:53
React App Event Bus Demo
import React, { useEffect, useRef, useState } from "react";
// --- 1. Event Bus Implementation ---
type EventMap = {
"modal:open": { modalId: string };
"modal:close": { modalId: string };
"listing:delete": { listingId: string };
"notification:show": { type: "success" | "error"; message: string };
"dom:action": {
@amit08255
amit08255 / plasmic-selfhosted.md
Last active January 10, 2025 19:44
Self-hosted Plasmic
@amit08255
amit08255 / react-dynamic-render.md
Last active December 10, 2024 17:46
React dynamic component rendering with JSON

Rendering React Components Dynamically with JSON

Approach 1: React component renderer with constants

{
    "type": "Container",
    "data": {
        "id": "4400936b-6158-4943-9dc8-a04c57e1af46",
        "items": [
@amit08255
amit08255 / form-security.md
Created September 5, 2024 19:05
JavaScript Form Protection

Protect Form From Spam

Method 1

This recipe puts a trivial speed bump in the way of form spammers. By forcing them to actually evaluate the page with a Javascript engine (or do extra processing to figure out what is needed), you raise the amount of effort required above that which most form spammers are likely to spend.

Step 1

Pick a nice random number. The SHA1 of some Git commit would be a good one. I picked this one: