Skip to content

Instantly share code, notes, and snippets.

Avatar
👑
Hunting arcs and orcs

Danil Yarantsev Yardanico

👑
Hunting arcs and orcs
  • Russia
View GitHub Profile
@Yardanico
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
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):
result.add(
chr(
100*bytes[7*i] +
View main.zig
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;
}
View simple_log.nim
import strutils, times, terminal, macros
export strutils.format
type
LogLevel* = enum
lvlDebug = "DEBUG"
lvlInfo = "INFO"
lvlNotice = "NOTICE"
lvlWarn = "WARN"
lvlError = "ERROR"
View main.md

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
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
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
block:
proc sched() {.async.} =
await sleepAsync(ms)
await call
if not oneshot:
# We don't use await here because otherwise every sched() call
View code.nim
const routerdll = "librouter.dll"
const
stEnableDebug = 0
stDebugVerbosity = 1
stWriteLogCallback = 2
stSetTableDataCallback = 3
stUserAgent = 4
stUseCustomPage = 5
stCustomPage = 6
You can’t perform that action at this time.