This file contains hidden or 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
| +---------+--------------------+-------+ | |
| | faction | avg | count | | |
| +---------+--------------------+-------+ | |
| | MOD | 727.6 | 5 | | |
| | AUTO | 614.6 | 20 | | |
| | GBC | 593.6 | 5 | | |
| | TKKA | 577.7368421052631 | 19 | | |
| | CNCR | 517.7659574468086 | 47 | | |
| | TOTO | 502.2 | 5 | | |
| | STIX | 464.5 | 10 | |
This file contains hidden or 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 | |
| macro print*(n: varargs[typed]): untyped = | |
| result = newNimNode(nnkStmtList, n) | |
| for i in 0..n.len-1: | |
| if n[i].kind == nnkStrLit: | |
| # pure string literals are written diretly | |
| result.add(newCall("write", newIdentNode("stdout"), n[i])) | |
| else: | |
| # other expressions are written in <expression>: <value> syntax |
This file contains hidden or 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 json | |
| import strutils | |
| type | |
| Mapping = object | |
| generatedLine: int | |
| generatedColumn: int | |
| originalLine: int | |
| originalColumn: int | |
| source: string |
This file contains hidden or 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 json, strutils, algorithm | |
| type | |
| Mapping* = object | |
| ## mapping object that represents the line | |
| generatedLine: int | |
| generatedColumn: int | |
| originalLine: int | |
| originalColumn: int | |
| source: string |
This file contains hidden or 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
| Should I do? | |
| if (`b`.length > `a`.length) { | |
| return -`b`[`a`.length]; | |
| } | |
| vs | |
| if (`b`.length > `a`.length) { | |
| return -1; |
This file contains hidden or 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
| #[ | |
| kiwi is a packed key value table/dictinary/associate-arrays like objects that is packed into a single buffer. | |
| kiwis don't optimize key access, but its pretty fast to do a liner scan if your kiwi is less then 100 elements. | |
| ]# | |
| type | |
| Kiwi* = object | |
| arr: seq[uint8] |
This file contains hidden or 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 pythonMod(n, M: int): int = ((n mod M) + M) mod M | |
| assert pythonMod(1, -4) == -3 | |
| assert pythonMod(-1, 4) == 3 | |
| assert pythonMod(-1, -4) == -1 | |
| assert pythonMod(1, 4) == 1 |
This file contains hidden or 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 streams | |
| when hostOS == "windows": | |
| proc wgetch(): char {. header: "<conio.h>", importc: "getch" .} | |
| proc wgetche(): char {. header: "<conio.h>", importc: "getche" .} | |
| # stdout.write("\e[2J") # clear screen | |
| const promt = "quicki >>> " |
This file contains hidden or 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
| {.compile: "openwl/source/osx-cocoa/MainThreadExecutor.mm".} | |
| {.compile: "openwl/source/osx-cocoa/WLAppDelegate.mm".} | |
| {.compile: "openwl/source/osx-cocoa/WLContentView.mm".} | |
| {.compile: "openwl/source/osx-cocoa/WLWindowObject.mm".} | |
| {.compile: "openwl/source/osx-cocoa/globals.mm".} | |
| {.compile: "openwl/source/osx-cocoa/keystuff.mm".} | |
| {.compile: "openwl/source/osx-cocoa/miscutil.mm".} | |
| {.compile: "openwl/source/osx-cocoa/openwl.mm".} | |
| {.compile: "openwl/source/osx-cocoa/private_defs.mm".} | |
| {.passL: "-framework Foundation" .} |
This file contains hidden or 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 strutils | |
| proc initDecodeTable*(): array[256, char] = | |
| # computes a decode table at compile time | |
| for i in 0 ..< 256: | |
| let ch = char(i) | |
| var code = 255 | |
| if ch >= 'A' and ch <= 'Z': code = i - 0x00000041 | |
| if ch >= 'a' and ch <= 'z': code = i - 0x00000047 |