Skip to content

Instantly share code, notes, and snippets.

@unnoq
unnoq / index.ts
Created June 17, 2024 02:00
zyte
‎‎​
@unnoq
unnoq / server.ts
Last active June 15, 2024 07:50
better-fetch
import { honoRouter } from '@api-node/lib/hono';
import { zValidator } from '@hono/zod-validator';
import { Dispatcher, ProxyAgent } from 'undici';
import { z } from 'zod';
export const betterFetchRouter = honoRouter.all(
'/',
zValidator(
'header',
z.object({
@unnoq
unnoq / highlight.ts
Last active May 31, 2024 09:55
tiptap
import { clone } from 'radash';
import type { JSONContent } from '@tiptap/core';
export function highlightContent(content: JSONContent[], words: string[]) {
let i = 0;
const result: JSONContent[] = [];
while (i < content.length) {
const child = content[i]!;
{
"files.associations": {
"*.css": "tailwindcss"
},
"tailwindCSS.classAttributes": [".*Variants", ".*Variants: .*"],
"tailwindCSS.experimental.classRegex": [
"'([^'\\n]*)'[,)\\]]",
"\"([^\"\\n]*)\"[,)\\]]",
"`([^`]*)`[,)\\]]",
@unnoq
unnoq / globals.css
Last active March 22, 2024 08:10
untitled-ui
@tailwind base;
@tailwind components;
@tailwind utilities;
@layer base {
:root {
--color-ring-brand: 158 119 237;
--color-ring-gray: 158 162 179;
--color-ring-gray-secondary: 158 162 179;
--color-ring-error: 240 68 56;
@unnoq
unnoq / batch.sql
Created October 13, 2023 03:59
postgresql
DO $$
DECLARE
counter integer := 1;
batch_size integer := 100;
BEGIN
WHILE counter <= 10000 LOOP
-- Use the counter to generate unique table names
EXECUTE 'CREATE TABLE IF NOT EXISTS "customer_histories_' || counter || '" PARTITION OF "customer_histories" FOR VALUES WITH (MODULUS 10000, REMAINDER ' || (counter - 1)::int || ');';
counter := counter + 1;
@unnoq
unnoq / extend.ts
Last active October 4, 2023 09:28
trpc-simulation
import { z } from 'zod';
type Innput<TShape extends z.Schema> = {
innput: TShape;
config: any;
};
type Fnn<TShape extends z.Schema> = (input: z.infer<TShape>) => void;
const fn: <TShape extends z.Schema, TFn extends Fnn<TShape>>(
@unnoq
unnoq / tsconfig.base.json
Last active July 6, 2023 14:20
typescript
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
/* Visit https://aka.ms/tsconfig.json to read more about this file */
/* Projects */
// "incremental": true, /* Enable incremental compilation */
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
// "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */
@unnoq
unnoq / xdebug.ini
Created November 21, 2022 08:44
php
zend_extension=xdebug.so
xdebug.mode = debug,develop,coverage
xdebug.start_with_request = yes
xdebug.log = /tmp/xdebug.log
@unnoq
unnoq / [laravel] phpstan.neon
Last active August 19, 2022 13:12
phpstan/phpstan
includes:
- ./vendor/nunomaduro/larastan/extension.neon
parameters:
reportUnmatchedIgnoredErrors: false
paths:
- app