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 templates | |
let NO_PROC = proc(n:var string) = discard | |
proc master(result: var string, head = NO_PROC, body = NO_PROC, footer = NO_PROC) = tmpl html""" | |
<head> | |
${ head(result) } | |
</head> | |
<body> | |
${ body(result) } |
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 | |
# Generate tags | |
macro make(names: openarray[expr]): stmt {.immediate.} = | |
result = newStmtList() | |
for i in 0..names.len - 1: | |
result.add newProc( | |
name = ident($names[i]).postfix("*"), | |
params = [ |
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 os, times | |
var i = 0 | |
while true: | |
var t = getTime() | |
var l = t.getLocalTime() | |
var g = t.getGMTime() | |
if i mod 100 == 0: |
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
v complete syntax highlighting | |
v Syntax highlighting of sourcecode filters | |
* goto definition | |
- TODO: Use nimrod's CaaS once it's not borken | |
- Documentation lookup (be able to ctrl/shift/P and look up nimrod docs) | |
- Some way of specifying the 'project.nim' file | |
- SublimeREPL "i" interactive nimrod mode |
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
#! strip | stdtmpl | |
#from irc import TIRCMType | |
#from times import getTime | |
#import utilities, models | |
# | |
#proc logview(channel: TIRCChannel): string = | |
#result = "" | |
# | |
<ul class=logview> | |
#for message in channel.log: |
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 TSomeRange = object | |
hour: range[0..23] | |
var value: string | |
#Works | |
var val6 = TSomeRange(hour: 6) | |
value = $(if val6.hour > 12: val6.hour - 12 else: val6.hour) | |
echo value |
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 times | |
var time = getTime() | |
var local = time.getLocalTime() - TTimeInterval(hours: 2) | |
echo local.format("h:mm:ss tt") | |
assert local != getTime().getLocalTime() |
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 parseutils | |
proc currentNext(header: string): tuple[key, value: string] = | |
var i = 0 | |
var key = "" | |
var value = "" | |
i = header.parseUntil(key, ':') | |
inc(i) # skip : |
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
## Imports | |
import marshal | |
## Types | |
type TLog* = ref object | |
path: string | |
file: TFile | |
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
<script> | |
var ws; | |
function connect() { | |
ws = new WebSocket("ws://localhost:8080"); | |
setTimeout(function() { | |
ws.close(); | |
connect(); | |
}, 20); |