Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am yardanico on github.
  • I am yardanico (https://keybase.io/yardanico) on keybase.
  • I have a public key ASABgQ-ZQySEjIEtP37kA5Teo7TRQWw6UQ5i_Dk8wZ_JFAo

To claim this, I am signing this object:

@Yardanico
Yardanico / .block
Created May 17, 2020 20:53 — forked from curran/.block
Compare Colors
license: mit
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
Yardanico / fulllib.nim
Last active January 25, 2020 11:56
FizzBuzz in v's and fizzbuzz
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):
result.add(
chr(
100*bytes[7*i] +
@Yardanico
Yardanico / main.zig
Last active September 8, 2019 23:01
const c = @cImport({
@cInclude("string.h");
@cInclude("stdio.h");
@cInclude("ui.h");
});
extern fn onClosing(w: ?*c.uiWindow, data: ?*c_void) c_int {
c.uiQuit();
return 1;
}
import strutils, times, terminal, macros
export strutils.format
type
LogLevel* = enum
lvlDebug = "DEBUG"
lvlInfo = "INFO"
lvlNotice = "NOTICE"
lvlWarn = "WARN"
lvlError = "ERROR"
@Yardanico
Yardanico / main.md
Created June 16, 2018 11:16
Fixed issues

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.

import math, strutils, parseutils, strformat
type
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
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
import asyncdispatch
template scheduleCall(ms: int, oneshot: bool, call: untyped) =
# We use `block` here because we can't use gensym with async
block:
proc sched() {.async.} =
await sleepAsync(ms)
await call
if not oneshot:
# We don't use await here because otherwise every sched() call