Skip to content

Instantly share code, notes, and snippets.

import nimbench
type
LocationStrategy* = enum
CssSelector = "css selector"
LinkTextSelector = "link text"
PartialLinkTextSelector = "partial link text"
TagNameSelector = "tag name"
XPathSelector = "xpath"
type
LocationStrategy* = enum
CssSelector
LinkTextSelector
PartialLinkTextSelector
TagNameSelector
XPathSelector
const
StrategyToString: array[LocationStrategy, string] = [
import tables
var a = initTable[string, Table[string, string]]()
a["data1"] = {"a": "b", "c": "d"}.toTable()
# or
a["data1"] = initTable[string, string]()
a["data1"]["a"] = "b"
import macros
proc myLast(x: NimNode): NimNode =
if x.kind == nnkStmtList and x.len == 1: x[0]
else: x.last()
gaga.nim(11, 7) template/generic instantiation from here
gaga.nim(36, 8) template/generic instantiation from here
gaga.nim(37, 5) template/generic instantiation from here
/home/tiber/.nimble/pkgs/nesm-0.3.1/nesm/basics.nim(40, 3) Error: expression has no address
proc `/`*(x: Uri, path: string): Uri =
## Concatenates the path specified to the specified URI's path.
##
## Contrary to the ``combine`` procedure you do not have to worry about
## the slashes at the beginning and end of the path and URI's path
## respectively.
##
## Examples:
##
## .. code-block::
import tables, strscans
proc readData(path: string): Table[string, string] =
result = initTable[string, string]()
for line in path.lines:
var ip, guid: string
var extra: string
if scanf(line, "$+ [$+] ($+)", extra, ip, guid):
echo "User action: ", ip, " ", guid
result[ip] = guid
import macros, strutils
export strutils
template parsestring(data): untyped = data
macro readLn*(args: varargs[typed]): untyped =
let data = genSym(nskLet, "input")
result = newTree(
nnkStmtList,
quote do:
import macros, strutils
template readLn(args: varargs[typed]): untyped =
let data = stdin.readLine().split()
var i = 0
while i < args.len:
let value = data[i]
when arg is int:
arg = parseInt(value)
elif arg is float:
{"a": "ɐ","b": "q", "c": "ɔ","d": "p",
"e": "ǝ","f": "ɟ", "g": "ƃ", "h": "ɥ",
"i": "ı", "j": "ɾ", "k": "ʞ", "m": "ɯ",
"n": "u", "p": "d", "q": "ᕹ", "r": "ɹ",
"t": "ʇ", "u": "n", "v": "ʌ", "w": "ʍ",
"y": "ʎ", ".": "˙", "[": "]", "(": ")",
"]": "[", ")": "(", "{": "}", "}": "{",
"?": "¿", "!": "¡", "\"": ",", ",": "'",
"<": ">", "_": "‾", "‿": "⁀", "⁅": "⁆",
"∴": "∵", "\r": "\n", "а": "ɐ", "б": "ƍ",