Skip to content

Instantly share code, notes, and snippets.

@mikimaine
mikimaine / shape-of-type.ts
Created June 1, 2023 17:26
A TypeScript type that will dynamically knows every nested object property. specially helpful when being used on a dynamic size object you want to access.
type ShapeOf<T extends Record<string, any>> = keyof {
[K in keyof T as T[K] extends string ? K: T[K] extends Record<string, unknown> ? `${K & string}.${ShapeOf<T[K]> & string}` : never]: any
}
const locales = {
en: {
welcome: 'welcome',
job: {
title: 'Job title',
@jewelsea
jewelsea / H2Tasks.java
Last active March 5, 2024 22:24
Sample for accessing a local database from JavaFX using concurrent tasks for database operations so that the UI remains responsive.
package h2app;
import javafx.application.Application;
import javafx.collections.*;
import javafx.concurrent.Task;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.stage.Stage;
@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a