Skip to content

Instantly share code, notes, and snippets.

type ModuleFunction = proc(api: VkApi, msg: Message): Future[void]
proc runCatch*(exec: ModuleFunction, bot: VkBot, msg: Message) =
let future = exec(bot.api, msg)
future.callback =
proc () =
if not future.failed:
return
try:
errors.nim(6, 19) Error: type mismatch: got (Future[system.void], proc (){.closure, locks: <unknown>.})
but expected one of:
proc callback=[T](future: FutureStream[T];
cb: proc (future: FutureStream[T]))
proc callback=[T](future: Future[T];
cb: proc (future: Future[T]))
proc callback=(future: FutureBase; cb: proc ())
import nigui, streams
app.init()
type
ColorId = range[0..15]
# https://www.reddit.com/r/place/comments/62z2uu/rplace_archive_update_and_boardbitmap_description/
proc toRgb(c: ColorId): Color =
case c
of 0: rgb(255, 255, 255)
#? replace(sub = "\t", by = " ")
#? braces
# Затем можно использовать их так:
for x in 0..10 {
echo 5
}
Traceback (most recent call last)
repro.nim(11) repro
asyncdispatch.nim(278) waitFor
asyncdispatch.nim(333) poll
asyncdispatch.nim(179) processPendingCallbacks
asyncmacro.nim(34) cb0
httpclient.nim(1022) parseResponseIter
httpclient.nim(201) httpError
[[reraised from:
repro.nim(11) repro
@Yardanico
Yardanico / calc.py
Created July 29, 2017 21:01 — forked from Zirak/calc.py
A Shunting Yard implementation in Python
#this program uses the Shunting Yard algorithm to transform infix expressions
# into postfix, and then an AST, which can then be easily evaluated.
#just run `python calc.py` and enjoy. enjoyment is optional and not included
# with the standard calc.py package, but for an extra $99.99 we can have a
# calc.py Premium Deluxe sent to you over the next 6-8 weeks, which may or may
# not increase your enjoyment of our calc.py product.
#for a list of operators supported and not supported (for isntance, the unary -
# is a ~) look below.
#TODO: handle parentheses.
@Yardanico
Yardanico / calc.py
Created July 29, 2017 21:01 — forked from Zirak/calc.py
A Shunting Yard implementation in Python
#this program uses the Shunting Yard algorithm to transform infix expressions
# into postfix, and then an AST, which can then be easily evaluated.
#just run `python calc.py` and enjoy. enjoyment is optional and not included
# with the standard calc.py package, but for an extra $99.99 we can have a
# calc.py Premium Deluxe sent to you over the next 6-8 weeks, which may or may
# not increase your enjoyment of our calc.py product.
#for a list of operators supported and not supported (for isntance, the unary -
# is a ~) look below.
#TODO: handle parentheses.
template answer(data: string) {.dirty.} =
api.sendMessage(data)
return
proc someHello(api: SomeApi) {.async.} =
try:
raise newException(Exception, "Oh, exception!")
except:
answer "Exception happened..."
echo "never happens"
C:\Users\Tiberium\Desktop\godot-nim\examples\stub>nake build
Compiling nakefile...
DETECTED MONITORS: 1
Activated GL 3.3 contextOpenGL ES 3.0 Renderer: GeForce GTX 750/PCIe/SSE2
GLES3: max ubo light: 409
GLES3: max ubo reflections: 455, ubo size: 144
ERROR: No loader found for resource: res://godotapi/api.json
At: core\io\resource_loader.cpp:223
ERROR: Failed loading scene: res://godotapi/api.json
At: main\main.cpp:1460