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 with --gc:arc | |
import ngxcmod, strutils | |
proc init(ctx: ContextCycle) {.exportc: "ngx_link_func_init_cycle", dynlib, cdecl.} = | |
setupForeignThreadGc() | |
ctx.cyc_log(INFO, "hello from Nim") | |
proc exit(ctx: ContextCycle) {.exportc: "ngx_link_func_exit_cycle", dynlib, cdecl.} = | |
setupForeignThreadGc() | |
ctx.cyc_log(WARN, "goodbye, from Nim w/ <3") |
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
package org.flowable.rest.app; | |
import java.util.Arrays; | |
import java.util.stream.StreamSupport; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import org.springframework.context.event.ContextRefreshedEvent; | |
import org.springframework.context.event.EventListener; | |
import org.springframework.core.env.AbstractEnvironment; |
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 this: void {.cdecl, exportc, dynlib.} = | |
var i = 1 | |
var a = 2 | |
var z = 3 | |
proc foo(): int = | |
echo "here" | |
return i + a + z + 65 |
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 processClient(client: AsyncSocket): owned(Future[void]) = | |
var retFuture_17906029 = newFuture("processClient") | |
iterator processClientIter_17906030(): owned(FutureBase) {.closure.} = | |
while true: | |
var future_17906031 = recvLine(client, {SafeDisconn}, 1000000) | |
yield future_17906031 | |
let line = read(future_17906031) | |
if len(line) == 0: | |
break | |
for c in items(clients): |
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 module_b | |
from module_c import nil | |
echo HelloFromModuleB | |
echo module_c.HelloFromModuleC |
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 criterion | |
var cfg = newDefaultConfig() | |
cfg.brief = true | |
const | |
sepSet = {'/', '\\'} | |
sepArray = ['/', '\\'] | |
proc dummy(a: string): bool = |
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
from strutils import nil | |
template copy(target: string, tRegion: Slice|HSlice, source: string, sRegion: Slice|HSlice): untyped = | |
template resolve(c, i): untyped = | |
when i is BackwardsIndex: | |
len(c) - int(i) | |
else: | |
i | |
# Figure out the length of each slice |
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
# A lazybuf is a lazily constructed path buffer. | |
# It supports append, reading previously appended chars, | |
# and retrieving the final string. It does not allocate a buffer | |
# to hold the output until that output diverges from s. | |
type lazybuf = object | |
path: string | |
buf: string | |
w: int | |
volAndPath: string | |
volLen: int |
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
type | |
WindowsPath* = distinct string | |
PosixPath* = distinct string | |
when OS_IS_WINDOWS: | |
type | |
Path* = distinct WindowsPath | |
IPath* = distinct Path | |
else: | |
type |
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
async proc foo(i: int) int = | |
await bar(i) // gives i+1 | |
await bar(i+1) // gives i+2 | |
await bar(i+2) // gives i+3 | |
# To | |
proc foo(state: var State) = | |
if state.state == 1: | |
state.waiting_on = bar(state.bar_state, state.i) |