Skip to content

Instantly share code, notes, and snippets.

@kachar
kachar / juma-ai-pricing.html
Last active February 27, 2026 09:43
Juma.ai — Sample Pricing Page (3-column usage-based)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width,initial-scale=1.0"/>
<title>Juma.ai - Pricing</title>
<link rel="preconnect" href="https://fonts.googleapis.com"/>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet"/>
<style>
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
@kachar
kachar / Link-Next13.tsx
Last active January 3, 2026 10:02
Next.js Link + Material UI Link/Button components bundled with forwardRef
create or replace function missing_fk_indexes ()
returns table (
referencing_table regclass,
fk_columns varchar,
table_size varchar,
fk_constraint name,
referenced_table regclass
)
@kachar
kachar / ReactRectangleSelection.tsx
Created June 11, 2024 13:16
ReactRectangleSelection from the https://github.com/remigallego/react-rectangle-selection discontinued code, converted to TypeScript
import React, {
CSSProperties,
MouseEvent,
useCallback,
useEffect,
useMemo,
useRef,
useState,
} from 'react'
@kachar
kachar / generateAzureImage.tsx
Created January 30, 2024 15:39
Dalee-3 Azure image geneation
import type { ImagesResponse } from 'openai/resources/images.mjs'
import type { AzureOpenAIInput, OpenAIChatInput } from '@langchain/openai'
import { typedFetch } from '@/server/utils/fetch.utils'
export const generateAzureImage = async ({
size,
prompt,
settings,
numImages,
}: {
@kachar
kachar / switch.tsx
Created January 27, 2024 06:48
shadcn switch with different sizes
'use client'
import type { VariantProps } from 'class-variance-authority'
import * as React from 'react'
import * as SwitchPrimitives from '@radix-ui/react-switch'
import { cva } from 'class-variance-authority'
import { cn } from '@/lib/utils'
const switchVariants = cva(
@kachar
kachar / README.md
Last active October 29, 2023 16:10
Profile Readme

GitHub Streak

@kachar
kachar / LocaleSwitcher.tsx
Last active February 1, 2023 06:56
i18next + next.js 10 + Material UI
import { useCallback } from 'react'
import { useRouter } from 'next/router'
import { useTranslation } from 'react-i18next'
import { Box, Button, ButtonGroup } from '@material-ui/core'
export default function LocaleSwitcher() {
const { t } = useTranslation()
const router = useRouter()
const changeLang = useCallback(
// Same route different language
import { Dispatch, SetStateAction, useState } from 'react'
export default function useLocalStorage<T>(
key: string,
initialValue: T,
): [T, Dispatch<SetStateAction<T>>] {
// State to store our value
// Pass initial state function to useState so logic is only executed once
const [storedValue, setStoredValue] = useState<T>(() => {
if (typeof window === 'undefined') {
@kachar
kachar / gist:0f787af108607a309c1c0858d87b34a2
Last active August 25, 2022 07:48 — forked from svilensabev/gist:713584cd30133969f395d1333563031e
PostgreSQL timeslots, rrulesets and booking timetables
-- First create schema/data data for tests
DROP TABLE api.slot CASCADE;
CREATE TABLE api.slot (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
name TEXT,
latitude NUMERIC,
longitude NUMERIC,
geog geography(Point, 4326) DEFAULT NULL