Skip to content

Instantly share code, notes, and snippets.

View d-bucur's full-sized avatar

Dorian Bucur d-bucur

  • country = f(time)
View GitHub Profile
@d-bucur
d-bucur / Prefabs.cs
Last active August 20, 2025 01:45
ECS factory pattern
static class Prefabs {
static Entity SpawnEnemy(Vec2I pos, EnemyType enemyType) {
Entity entt = PrepEnemyCommon(pos);
switch (enemyType) {
case EnemyType.Skeleton:
entt.Add(
new EntityName { value = "Skeleton" },
new TextureWithSource(Assets.monsterTexture) {
TileIdx = new Vec2I(0, 4)
},
@d-bucur
d-bucur / dispatch-tests.md
Last active September 7, 2023 21:56
Rust dispatch tests

Benchmarking different ways to dispatch to a trait method, using static dispatch (compile time polymorphism), dynamic dispatch (runtime polymorphism) and dynamic dispatch backed by an arena allocator.

cargo.toml

[dependencies]
bumpalo = "3.13.0"
criterion = "0.5.1"

[[bench]]
name = "my_benchmark"
npm command Yarn command pnpm equivalent bun equivalent
npm install yarn pnpm install bun install
npm install [pkg] yarn add [pkg] pnpm add [pkg] bun add [pkg]
npm uninstall [pkg] yarn remove [pkg] pnpm remove [pkg] bun remove [pkg]
npm update yarn upgrade pnpm update bun update
npm list yarn list pnpm list ?
npm run [scriptName] yarn [scriptName] pnpm [scriptName] bun run [scriptName]
npx [command] yarn dlx [command] pnpm dlx [command] bunx [command]
npm exec yarn exec [c
@d-bucur
d-bucur / extension-scaffold.md
Last active July 6, 2023 18:56
Tools to help with scaffolding a browser extension with Vue/Vite

Vite config possible

These have an interactive configuration similar to Vite, allowing you to select the framework (Vue, React, etc.)

Vite Plugin Web Extension (lightweight pick)

https://vite-plugin-web-extension.aklinker1.io/

  • Vite: with initializer
  • Chrome and Firefox
  • Newer, works nicely, dev loads extension into separate browser profile

CRXJS