First suggestion:
src/
<pkgname>.nim
tests/
docs/
<pkgname>.nimble # with srcDir = "src"
library with single module
First suggestion:
src/
<pkgname>.nim
tests/
docs/
<pkgname>.nimble # with srcDir = "src"
library with single module
| package io.mashingan.getfetching | |
| /* | |
| Compile like from console: | |
| $ kotlinc jsonfetcher.kt -include-runtime -d jsonf.jar | |
| $ java -jar jsonf.jar | |
| */ | |
| //import org.json.JSONObject | |
| import java.net.HttpURLConnection |
| import winim | |
| proc quit(value: DWORD) = | |
| quit value.int | |
| proc refreshDirectory(handle: var HANDLE) = | |
| handle = FindFirstChangeNotification(".", false, | |
| FILE_NOTIFY_CHANGE_FILE_NAME) | |
| if handle == INVALID_HANDLE_VALUE: | |
| quit GetLastError() |
| import macros | |
| macro match(head, body: untyped): untyped = | |
| result = newNimNode nnkStmtList | |
| var casenode = newNimNode nnkCaseStmt | |
| casenode.add head | |
| for node in body: | |
| node.expectKind nnkInfix |
| # Configuration file for the Nim Compiler. | |
| # (c) 2017 Andreas Rumpf | |
| # Feel free to edit the default values as you need. | |
| # You may set environment variables with | |
| # @putenv "key" "val" | |
| # Environment variables can be accessed like so: | |
| # gcc.path %= "$CC_PATH" |
| // run it with | |
| // > wscript rename.js | |
| // in the folder where the script resides | |
| // | |
| // or double-click it | |
| var script = WScript.CreateObject("WScript.Shell"); | |
| var fso = WScript.CreateObject("Scripting.FileSystemObject"); | |
| for (var i = 28; i < 100; i++) { | |
| var file = fso.GetFile('pg' + i + '.png'); |
| ## The implementation of Sleeping Barber Problem | |
| ## https://en.wikipedia.org/wiki/Sleeping_barber_problem | |
| ## The `seatAvailable` is guarded with `queue` Lock while the barber | |
| ## explicitly acquired and released | |
| ## Using pointer math as written in this post | |
| ## https://forum.nim-lang.org/t/1188#7366 | |
| ## compile and run: $ nim c -r --threads:on --threadAnalysis:off barbershop.nim | |
| from os import sleep | |
| from random import random, randomize |
| input { | |
| width: 100%; | |
| display: block; | |
| } |
| var mycommander = require('./mycommander'); | |
| console.log(mycommander); | |
| console.log(process.argv.slice(2)); | |
| mycommander | |
| .option('-f, --foo i', 'Integer value for foo', parseInt, 0) | |
| .option('-b, --bar j', 'Integer value for bar', parseInt, 0) | |
| .option('-z, --baz', 'Boolean argument baz') | |
| .parse(process.argv.slice(2)); |
| /* | |
| * The call in console: | |
| * $ node digitcombinatorial.js [maxnumber] [digitpattern] | |
| * | |
| * If maxnumber and digitpattern is not supplied in command line, it will | |
| * fallback to the default 10000 and 14 respectively | |
| */ | |
| // Initial parameter definition. Since it is parameter, it's expected won't | |
| // be changed during runtime. |