Skip to content

Instantly share code, notes, and snippets.

type
EmbeddedImage* = distinct Image
EmbeddedWave* = distinct Wave
EmbeddedFont* = distinct Font
ShaderLocsPtr* = distinct typeof(Shader.locs)
proc `=destroy`*(x: var EmbeddedImage) = discard
proc `=dup`*(source: EmbeddedImage): EmbeddedImage {.nodestroy.} = source
proc `=copy`*(dest: var EmbeddedImage; source: EmbeddedImage) {.nodestroy.} =
<div id="ROOT">
<header>
<h2 class="font-light text-2xl md:text-4xl text-gray-600">Ancient Wisdom</h2>
</header>
<div class="mt-8">
<img src="blurred.jpg" alt="" class="absolute" width=1464>
<div class="bg-white rounded-md overflow-hidden shadow-xl relative">
<img src="portrait.jpg" alt="" width="512" height="512" class="">
<div class="">
import os, enum, shutil, subprocess
class CpuPlatform(enum.Enum):
arm = 1
arm64 = 2
i386 = 3
amd64 = 4
class DeviceOrientation(enum.Enum):
portrait = 1
@planetis-m
planetis-m / nim.cfg
Last active March 12, 2025 08:58
Top level nim.cfg
#cc = clang
--experimental:strictEffects
--experimental:strictFuncs
--experimental:strictDefs
--experimental:unicodeOperators
--experimental:overloadableEnums
--define:nimPreviewCstringConversion
--define:nimPreviewFloatRoundtrip
--define:nimStrictDelete
--define:nimUseLinenoise
@planetis-m
planetis-m / mybuildcmds.rst
Last active June 20, 2025 19:56
My build commands

Debug

nim c --cc:clang --mm:orc --panics:on --threads:on -l:"-fuse-ld=mold" %f

Release

from typetraits import supportsCopyMem
const
maxEntities* = 10_000
type
Array*[T] = object
data: ptr array[maxEntities, T]
proc `=destroy`*[T](x: var Array[T]) =
# Compile with: nim c --gc:orc --panics:on --fieldChecks:on casevariants
# Compare with -d:emiDuplicateKey -d:emiLenient
import eminim, std/[parsejson, streams]
type
Fruit = enum
Banana, Apple
Bar = object
shared: int
import eminim, std/[parsejson, streams]
type
Fruit = enum
Banana, Apple
Bar = object
shared: int
kind: Fruit
bad: float
@planetis-m
planetis-m / csp.nim
Created January 19, 2021 00:47
Classic Computer Science Problems in Python
import tables, options, sugar
type
Constraint*[V, D] = ref object
# Base class for all constraints
variables*: seq[V] # The variables that the constraint is between
satisfied*: proc (assignment: Table[V, D]): bool
Csp*[V, D] = object
# A constraint satisfaction problem consists of variables of type V
import tables
type
DirKind = enum # must be ordered alphabetically!
dkNone, dkAttention, dkAuthor, dkAuthors, dkCaution, dkCode, dkCodeBlock, dkContainer, dkContents, dkDanger,
dkError, dkFigure, dkHint, dkImage, dkImportant, dkInclude, dkIndex, dkNote, dkRaw, dkTip, dkTitle, dkWarning
const
DirIds: array[DirKind, string] = [
dkNone: "",