Skip to content

Instantly share code, notes, and snippets.

@dawkot

dawkot/foo.nim Secret

Created August 28, 2019 16:57
Show Gist options
  • Save dawkot/9ad53b68f4bc62e977708771c5bd23f8 to your computer and use it in GitHub Desktop.
Save dawkot/9ad53b68f4bc62e977708771c5bd23f8 to your computer and use it in GitHub Desktop.
Karax problem
import strutils
include karax / prelude
type Foo = ref object
str: string
template foo(x): untyped = Foo(str: x)
var sequences: seq[seq[Foo]]
for i in 1..10:
sequences.add @[foo"foo", foo"bar", foo"baz", foo"xyz", foo"abc"]
setRenderer proc: VNode =
proc render(foo: Foo): VNode = buildHtml:
button(id=foo.str):
text foo.str
proc onClick =
if foo.str[0].isUpperAscii:
foo.str[0] = foo.str[0].toLowerAscii
else:
foo.str[0] = foo.str[0].toUpperAscii
buildHtml tdiv:
tdiv:
tdiv:
tdiv:
tdiv:
tdiv:
tdiv:
tdiv:
for s in sequences:
for foo in s: render foo
br()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment