Skip to content

Instantly share code, notes, and snippets.

View ycmjason's full-sized avatar
😆

YCM Jason ycmjason

😆
View GitHub Profile
@ycmjason
ycmjason / tsconfig.json
Created October 16, 2025 03:54
hello world
{
"extends": "../../tsconfig.node.json",
"include": ["src/**/*", "bin/**/*"]
}
@ycmjason
ycmjason / .gitignore
Created October 16, 2025 03:52
hello world
node_modules
dist
.DS_Store
.env
# Ignore the output video from Git but not videos you import into src/.
out
.secrets
.cache
@ycmjason
ycmjason / gist:b1ea2a3abaa0e508ad56dfaf34e1fde4
Created October 15, 2025 05:16
mission-to-zog data url
This file has been truncated, but you can view the full file.
@ycmjason
ycmjason / Icon.tsx
Created February 11, 2025 21:59
expo-icon FontAwesome 5 / 6 type safe icon component
import type { createIconSet } from '@expo/vector-icons';
import Untyped_FontAwesome6 from '@expo/vector-icons/FontAwesome6';
import type { FA6Style } from '@expo/vector-icons/build/FontAwesome6';
import type { ComponentProps, ReactNode } from 'react';
type FA6Variant = keyof typeof FA6Style;
type IconComponent = ReturnType<typeof createIconSet<string, string>>;
const FontAwesome6: IconComponent = Untyped_FontAwesome6;
export const Icon = ({
@ycmjason
ycmjason / PartialLoadingBar.tsx
Last active October 27, 2024 13:29
Deno Fresh Partial Fetch Events
import { useSignal } from "@preact/signals";
import { useEffect } from "preact/hooks";
export const PartialLoadingBar = () => {
const loadState = useSignal<"loading" | "loaded" | "not-loading">(
"not-loading",
);
useEffect(() => {
const onBeforePartialFetch = () => {
loadState.value = "loading";
type KeysOfUnion<T> = T extends T ? keyof T : never;
export type ExclusiveUnion<T> = KeysOfUnion<T> extends
infer K extends PropertyKey
? T extends infer A ? A & Partial<Record<Exclude<K, keyof A>, never>>
: never
: never;
@ycmjason
ycmjason / README.md
Created July 6, 2024 11:30
async queue with async generator

with this async generator queue, you could make sure the tasks given are run with at a maximum concurrency

@ycmjason
ycmjason / rerenderable.kt
Created April 27, 2024 23:55
A composable that allow particular block to be rerendered manually
@Composable
fun <T> rerenderable(
beforeRerender: () -> Unit = {},
block: @Composable (rerender: () -> Unit) -> T,
): () -> Unit {
var id by remember { mutableStateOf(0) }
val rerender = {
beforeRerender()
id += 1
}
@ycmjason
ycmjason / LazyListScope.itemsWithDivider.kt
Created April 20, 2024 22:41
List item with divider
package app.fishball.taskshuffle.ui.components.contextless
import androidx.compose.foundation.lazy.LazyItemScope
import androidx.compose.foundation.lazy.LazyListScope
import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.runtime.Composable
inline fun <T> LazyListScope.itemsWithDivider(
items: List<T>,
noinline divider: (@Composable LazyItemScope.(left: T, right: T) -> Unit),
@ycmjason
ycmjason / .prettierrc.json
Created October 26, 2023 09:54
Best Prettier Config In The World
{
"printWidth": 100,
"semi": true,
"singleQuote": true,
"trailingComma": "all",
"arrowParens": "avoid"
}