Skip to content

Instantly share code, notes, and snippets.

@zerkalica
zerkalica / builder.mjs
Created July 24, 2024 10:20
npm builder for mol
// @ts-check
import url from 'node:url'
import { basename, join } from 'node:path'
import { stat, writeFile, readFile } from 'node:fs/promises'
import { spawn } from 'node:child_process'
/**
* @param {unknown} value
* @returns {value is import('esbuild').Plugin}
```
cloc . --not-match-d=".*(node_modules|-|legacy|npm|\.mam|\.ci|adm).*"
424 text files.
287 unique files.
3980 files ignored.
github.com/AlDanial/cloc v 2.00 T=0.32 s (890.4 files/s, 59111.0 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
@zerkalica
zerkalica / build.mjs
Created January 31, 2024 08:36
build.mjs
import { buildSync } from 'esbuild'
import { join } from 'path'
import { writeFileSync, readFileSync } from 'fs'
import { spawnSync } from 'child_process'
export function gdKitBuild({ args }) {
const monorepo_root = process.cwd()
const sync_opts = {
stdio: 'inherit',
stderr: 'inherit',
@zerkalica
zerkalica / entity.ts
Created January 9, 2024 23:01
entity.ts
namespace $ {
const str = () => ('00000000000000000' + (Math.random() * 0xffffffffffffffff).toString(16)).slice(-16)
export class $gd_kit_entity extends $mol_object {
constructor(id?: string) {
super()
if (id) this.id = $mol_const(id)
}
import { context, build } from 'esbuild'
import { glsl } from 'esbuild-plugin-glsl'
import resolve from 'esbuild-plugin-resolve'
import url from 'url'
const metaUrl = import.meta.url
const args = process.argv.slice(2)
const absWorkingDir = url.fileURLToPath(new URL('.', metaUrl))
const config = {
@zerkalica
zerkalica / media-seq.ts
Last active March 30, 2024 15:37
media-seq.ts
namespace $ {
export type $gd_kit_media_resource = { id: string, text: string }
export class $gd_kit_media_sequence extends $mol_audio_room {
tts_id() {
return '' as string | null | undefined
}
@ $mol_mem_key
@zerkalica
zerkalica / use-wait.ts
Created December 27, 2023 22:56
wait.ts
namespace $ {
export type $gd_speech_ws_command =
| {
cmd: 'init'
data: {
app_ref: string
audio_guid: string
final_sep: string
samplerate: number
source: string
@zerkalica
zerkalica / link.view.tree
Created December 17, 2023 19:04
mol alt links
@zerkalica
zerkalica / rbh.d.ts
Last active December 17, 2023 09:01
rg
declare namespace $ {
type $mol_view_tree2_to_js_test_ex_right_hierarchy_bar__id__CP48JLAJ = $mol_type_enforce<
ReturnType< $foo['indexed_id'] >
,
ReturnType< $bar['id'] >
>
type $foo_indexed_title__W0JNK55Y = $mol_type_enforce<
Parameters< $foo['indexed_title'] >[0]
,
@zerkalica
zerkalica / link.ts
Created December 1, 2023 08:55
hierarchical off links in mol