nim c --cc:clang --mm:orc --panics:on --threads:on --threadanalysis:off --tlsEmulation:off -l:"-fuse-ld=mold" %f
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proc sortObject(tree: var JsonTree, n: NodePos) = | |
var pairs: seq[(string, NodePos)] | |
for ch0 in sonsReadonly(tree, n): | |
let key = firstSon(NodePos ch0.pos).str | |
let value = NodePos(ch0.pos + 2) | |
pairs.add((key, value)) | |
pairs.sort do (a, b: (string, NodePos)) -> int: | |
cmp(a[0], b[0]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.} = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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=""> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, enum, shutil, subprocess | |
class CpuPlatform(enum.Enum): | |
arm = 1 | |
arm64 = 2 | |
i386 = 3 | |
amd64 = 4 | |
class DeviceOrientation(enum.Enum): | |
portrait = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#cc = clang | |
--experimental:strictEffects | |
--experimental:strictFuncs | |
--experimental:strictDefs | |
--experimental:unicodeOperators | |
--experimental:overloadableEnums | |
--define:nimPreviewCstringConversion | |
--define:nimPreviewFloatRoundtrip | |
--define:nimStrictDelete | |
--define:nimUseLinenoise |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typetraits import supportsCopyMem | |
const | |
maxEntities* = 10_000 | |
type | |
Array*[T] = object | |
data: ptr array[maxEntities, T] | |
proc `=destroy`*[T](x: var Array[T]) = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import eminim, std/[parsejson, streams] | |
type | |
Fruit = enum | |
Banana, Apple | |
Bar = object | |
shared: int | |
kind: Fruit | |
bad: float |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
NewerOlder