Skip to content

Instantly share code, notes, and snippets.


Keybase proof

I hereby claim:

  • I am yardanico on github.
  • I am yardanico ( on keybase.
  • I have a public key ASABgQ-ZQySEjIEtP37kA5Teo7TRQWw6UQ5i_Dk8wZ_JFAo

To claim this, I am signing this object:

Yardanico / .block
Created May 17, 2020 — forked from curran/.block
Compare Colors
View .block
license: mit
View bench.nim
import mathexpr
import std / [times, monotimes, stats]
var r: RunningStat
for iterations in 1..5:
let start = getMonoTime()
let e = newEvaluator()
for i in 0 ..< 1000000:
let r = e.eval("100^---+-++---++-+-+-.5+1 + --(1e2^(+(-(-(-.5e0))))+1e0)")
Yardanico / fulllib.nim
Last active Jan 25, 2020
FizzBuzz in v's and fizzbuzz
View fulllib.nim
import macros, strutils, sequtils, sugar
var bytes {.compileTime.}: seq[int]
const chars = ["fizz", "buzz", "fizzbuzz"]
proc translate(): string =
for i in 0..<(bytes.len div 7):
100*bytes[7*i] +
View main.zig
const c = @cImport({
extern fn onClosing(w: ?*c.uiWindow, data: ?*c_void) c_int {
return 1;
View simple_log.nim
import strutils, times, terminal, macros
export strutils.format
LogLevel* = enum
lvlDebug = "DEBUG"
lvlInfo = "INFO"
lvlNotice = "NOTICE"
lvlWarn = "WARN"
lvlError = "ERROR"

This is a document containing all fixed (in current devel) but not yet closed issues from nim-lang/Nim repository. Most of the issues can't be closed immediately because they require a test-case, that's why I created this document.

View mathexpr_parse.nim
import math, strutils, parseutils, strformat
MathFunction = proc(args: seq[float]): float
NodeKind = enum
Num, Mul, Div, Mod, Pow, Add, Sub, UnarySub, UnaryAdd, Fun, Var
Node = ref object
case kind: NodeKind
View json_case_parse.nim
import macros, json
type Event = ref object of RootObj
id: string
type TestMade = ref object of Event
name: string
type Test = ref object of Event
View scheduling.nim
import asyncdispatch
template scheduleCall(ms: int, oneshot: bool, call: untyped) =
# We use `block` here because we can't use gensym with async
proc sched() {.async.} =
await sleepAsync(ms)
await call
if not oneshot:
# We don't use await here because otherwise every sched() call