Skip to content

Instantly share code, notes, and snippets.

View Skia69's full-sized avatar
Feel the vibes~

σκιά Skia69

Feel the vibes~
View GitHub Profile
@Skia69
Skia69 / README.md
Created May 29, 2023 14:26 — forked from lopspower/README.md
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@Skia69
Skia69 / [[...slug]].ts
Created June 17, 2023 11:43 — forked from mxkaske/[[...slug]].ts
Create a reduced REST API with Upstash and Nextjs App Router and optional catch-all segments
// /app/api/upstash/[[...slug]].ts
import { Redis } from "@upstash/redis";
const redis = Redis.fromEnv();
type Params = { slug: string | string[] | undefined };
function createKey(slug: Params["slug"]) {
return slug ? [...(Array.isArray(slug) ? slug : [slug])].join(":") : "_root";
}
@Skia69
Skia69 / Toast.tsx
Created July 30, 2023 22:38 — forked from derekstavis/Toast.tsx
React Native Toast, without Context hell
/* Layout and Text components are my own utility components. Replace them by your own. */
import { memo, useEffect, useMemo, useState } from "react";
import { ViewStyle } from "react-native";
import { A } from "@mobily/ts-belt";
import mitt from "mitt";
import { v4 as uuid } from "@lukeed/uuid";
import Animated, {
Layout as REALayout,
Easing,
@Skia69
Skia69 / safeParse.ts
Created August 7, 2023 17:20 — forked from gimenete/safeParse.ts
A wrapper around the fetch function that validates the response body against a Zod schema
import z from "zod";
export async function safeFetch<T>(
schema: z.Schema<T>,
input: RequestInfo,
init?: RequestInit
): Promise<T> {
const response = await fetch(input, init);
if (!response.ok) {
@Skia69
Skia69 / custom-file-size-units.js
Created March 28, 2024 15:45 — forked from joelstransky/custom-file-size-units.js
Custom Intl.NumberFormat units
sizeFormatter = new Intl.NumberFormat([], {
style: "unit",
unit: "byte",
notation: "compact",
unitDisplay: "narrow",
});
(_bytes) => {
const units = { B: " bytes", KB: " kb", MB: " mb", GB: " gb", TB: " tb" };
const parts = sizeFormatter.formatToParts(_bytes);
@Skia69
Skia69 / repository.ts
Created April 18, 2024 12:26 — forked from cayter/LICENSE
Drizzle ORM Type-Safe Repository With PgTable
import { startSpan } from "@sentry/remix";
import type { StartSpanOptions } from "@sentry/types";
import {
type AnyColumn,
type AnyTable,
type BuildQueryResult,
type DBQueryConfig,
type DrizzleTypeError,
type Equal,
type ExtractTablesWithRelations,
import { Client } from "@upstash/qstash"
import { NextRequest } from "next/server"
const baseUrl = process.env.NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL
? `https://${process.env.NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL}`
: "http://localhost:3000"
interface Step<I> {
create: <O>(action: (prevResult: Awaited<I>) => O) => Step<O>
finally: (action: (prevResult: Awaited<I>) => any) => any

Next.js Starters

A list of CLI generators, starter kits / boilerplates and toolkits to kick start your Next.js apps.

  • What is included in this list:
    • Has ~1K+ Github stars
    • Actively maintained / up to date
    • Includes a style / css solution or UI Framework
    • Includes a database
  • Includes authentication / authorization
@Skia69
Skia69 / await.ts
Created April 6, 2025 15:03 — forked from perfectbase/await.tsx
Await component for Next.js
import { Fragment, Suspense, type ReactNode } from 'react';
import { ErrorBoundary } from 'react-error-boundary';
type AwaitProps<T> = {
promise: Promise<T>;
children: (data: T) => ReactNode;
fallback?: ReactNode;
errorComponent?: ReactNode;
};
@Skia69
Skia69 / await.tsx
Created June 18, 2025 11:17 — forked from perfectbase/await.tsx
Await component for tRPC with prefetch
/* eslint-disable @typescript-eslint/no-explicit-any */
import { type TRPCQueryOptions } from '@trpc/tanstack-react-query';
import { unstable_noStore } from 'next/cache';
import { Fragment, Suspense, type ReactNode } from 'react';
import { ErrorBoundary } from 'react-error-boundary';
import { HydrateClient, prefetch as prefetchTRPC } from '@/trpc/server';
type AwaitProps<T> =
| {
promise: Promise<T>;