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
# Extract of the testfile: | |
Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F | |
00000000 44 61 74 65 3A 20 46 72 69 2C 20 31 39 20 4D 61 Date: Fri, 19 Ma | |
00000010 79 20 32 30 30 30 20 31 30 3A 31 38 3A 30 33 20 y 2000 10:18:03 | |
00000020 2D 30 34 30 30 20 28 45 44 54 29 0D 0A 46 72 6F -0400 (EDT)..Fro | |
00000030 6D 3A 20 44 6F 75 67 20 53 61 75 64 65 72 20 3C m: Doug Sauder < | |
00000040 64 6F 75 67 40 70 65 6E 67 75 69 6E 2E 65 78 61 [email protected] | |
00000050 6D 70 6C 65 2E 63 6F 6D 3E 0D 0A 54 6F 3A 20 3D mple.com>..To: = |
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
Date: Fri, 19 May 2000 10:18:03 -0400 (EDT) | |
From: Doug Sauder <[email protected]> | |
To: =?iso-8859-1?Q?J=FCrgen_Schm=FCrgen?= <[email protected]> | |
Subject: =?iso-8859-1?Q?Die_Hasen_und_die_Fr=F6sche?= | |
Message-ID: <[email protected]> | |
MIME-Version: 1.0 | |
Content-Type: TEXT/PLAIN; charset=iso-8859-1 | |
Content-Transfer-Encoding: QUOTED-PRINTABLE | |
Die Hasen und die Fr=F6sche |
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 asyncdispatch, asynchttpserver | |
type SomeObj = object | |
someData: string | |
proc manageUiCallback(req: Request): Future[void] {.async.} = | |
var res = "" | |
# This callback wants to access someObj somehow! | |
res.add someObj.someData |
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
Im trying to use boltforms, | |
if i follow the example and include a form | |
{{ boltforms('anonymous-comments') }} | |
in a template which also extends my base template i get: | |
Twig_Error_Runtime in Template.php (mysite/vendor/twig/twig/lib/Twig/Template.php) line 230: | |
An exception has been thrown during the rendering of a template | |
("A form of the name "anonymous-comments" has already been created.") in "contact.twig" at line 5. |
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 times | |
import options | |
type | |
Entry = object of RootObj | |
emergeDate: Option[DateTime] | |
publishDate: Option[DateTime] | |
proc newEntry(): Entry = | |
# Gives: Error: fields not initialized: emergeDate, publishDate. |
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 httpclient, asyncdispatch | |
var client = newAsyncHttpClient() | |
proc onProgressChanged(total, progress, speed: BiggestInt) {.async.} = | |
echo("Downloaded ", progress, " of ", total) | |
echo("Current rate: ", speed div 1000, "kb/s") | |
client.onProgressChanged = onProgressChanged | |
echo waitFor client.getContent("http://speedtest-ams2.digitalocean.com/100mb.test") |
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 webview | |
import strutils | |
import os | |
const indexHTML = """ | |
<!doctype html> | |
<html> | |
<head> |
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
## Store multiple "bool" values in an integer | |
# http://blog.millermedeiros.com/using-integers-to-store-multiple-boolean-values/ | |
type foos = enum | |
foo = 1.shl 0, # 1 | |
baa = 1.shl 1, # 2 | |
baz = 1.shl 2 # 4 | |
echo foo.int | |
echo baa.int | |
echo baz.int |
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 ServiceMain = proc(gSvcStatus: SERVICE_STATUS) | |
proc wrapServiceMain(mainProc: ServiceMain): LPSERVICE_MAIN_FUNCTION {.closure.} = | |
## wraps a nim proc in a LPSERVICE_MAIN_FUNCTION | |
return proc(dwArgc: DWORD, lpszArgv: LPTSTR) {.stdcall.} = | |
gSvcStatusHandle = RegisterServiceCtrlHandler( | |
SERVICE_NAME, | |
svcCtrlHandler | |
) | |
gSvcStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS | |
gSvcStatus.dwServiceSpecificExitCode = 0 |
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
# test with: `while true; do curl 127.0.0.1:8080; done` | |
# import threadpool | |
import locks | |
import os | |
import asyncdispatch | |
import asynchttpserver, asyncdispatch | |
var L: Lock | |
type Context = ref object {.pure.} |
OlderNewer