Skip to content

Instantly share code, notes, and snippets.

Danil Yarantsev Yardanico

Block or report user

Report or block Yardanico

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
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 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 encode.nim
import strutils, strtabs, cgi
proc encode*(params: StringTableRef, isPost = true): string =
result = if not isPost: "?" else: ""
if not params.isNil():
for key, val in pairs(params):
let
enck = cgi.encodeUrl(key)
encv = cgi.encodeUrl(val)
result.add($enck & "=" & $encv & "&")
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 nimcalc.nim
import math, strutils
const
ArgsErrorMsg = "Incorrect number of arguments at pos $1 in function `$2`"
CharErrorMsg = "Unexpected char `$1` at pos $2"
proc eval(data: string): float =
## Evaluates math expression from string *data* and returns result as a float
var data = data.toLowerAscii()
View code.nim
const routerdll = "librouter.dll"
const
stEnableDebug = 0
stDebugVerbosity = 1
stWriteLogCallback = 2
stSetTableDataCallback = 3
stUserAgent = 4
stUseCustomPage = 5
stCustomPage = 6
View gist:33ac27d190b0c0a56787c4e23a706db3
total executions of each stack trace:
Entry: 1/41 Calls: 239/689 = 34.69% [sum: 239; 239/689 = 34.69%]
test.nim: expand 632/689 = 91.73%
test.nim: test 689/689 = 100.00%
Entry: 2/41 Calls: 55/689 = 7.98% [sum: 294; 294/689 = 42.67%]
test.nim: pixelsOn 55/689 = 7.98%
test.nim: test 689/689 = 100.00%
Entry: 3/41 Calls: 42/689 = 6.10% [sum: 336; 336/689 = 48.77%]
hashes.nim: hash 181/689 = 26.27%
hashes.nim: hash 181/689 = 26.27%
You can’t perform that action at this time.