This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import nimbench | |
type | |
LocationStrategy* = enum | |
CssSelector = "css selector" | |
LinkTextSelector = "link text" | |
PartialLinkTextSelector = "partial link text" | |
TagNameSelector = "tag name" | |
XPathSelector = "xpath" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type | |
LocationStrategy* = enum | |
CssSelector | |
LinkTextSelector | |
PartialLinkTextSelector | |
TagNameSelector | |
XPathSelector | |
const | |
StrategyToString: array[LocationStrategy, string] = [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import macros | |
proc myLast(x: NimNode): NimNode = | |
if x.kind == nnkStmtList and x.len == 1: x[0] | |
else: x.last() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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:: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"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", "а": "ɐ", "б": "ƍ", |