Skip to content

Instantly share code, notes, and snippets.

proc newSeqAlias[T](): seq[T] =
result = newSeq[T]
template test(t: typedesc) =
var mmmm = newSeqAlias[t]()
when isMainModule:
test(int)
proc newSeqAlias[T](): seq[T] =
result = newSeq[T]()
template test(t: typedesc) =
var mmmm = newSeqAlias[t]()
when isMainModule:
test(int)
type TKind = enum
tkDef,
tkOther
type TTest = object
case kind: TKind
of TDef: value: int
of TOther: array[1..3, TTeset]
```
fizzbuzz!fizzbuzzInit:
00ae2510 55 push ebp
00ae2511 8bec mov ebp,esp
00ae2513 83ec28 sub esp,28h
00ae2516 c745dc40e9b100 mov dword ptr [ebp-24h],offset fizzbuzz!nimNaN+0x7b00 (00b1e940)
00ae251d c745e44ce9b100 mov dword ptr [ebp-1Ch],offset fizzbuzz!nimNaN+0x7b0c (00b1e94c)
00ae2524 c745e000000000 mov dword ptr [ebp-20h],0
00ae252b 33c0 xor eax,eax
00ae252d 668945e8 mov word ptr [ebp-18h],ax
@barcharcraz
barcharcraz / gist:5ed117b13426b150c8fe
Created August 19, 2014 22:19
non-working version
```
fizzbuzz!fizzbuzzInit:
00992510 55 push ebp
00992511 8bec mov ebp,esp
00992513 83ec28 sub esp,28h
00992516 c745dc40e99c00 mov dword ptr [ebp-24h],offset fizzbuzz!nimNaN+0x7b1c (009ce940)
0099251d c745e44ce99c00 mov dword ptr [ebp-1Ch],offset fizzbuzz!nimNaN+0x7b28 (009ce94c)
00992524 c745e000000000 mov dword ptr [ebp-20h],0
0099252b 33c0 xor eax,eax
0099252d 668945e8 mov word ptr [ebp-18h],ax
import windows
import dxgi
import d3d12
import d3dcompiler
const winClass = "directNimrod"
#rendering constants
const width = 800
const height = 600
stored:
type Scene = select(filename: string, filedata: seq[uint8]) `from` scene_data
var db: PSqlite3
discard open(paramStr(1), db)
var testScenes = db.load(Scene)
for s in testScenes: echo s.filename
var testScene = testScenes[0]
testScene.filename = "wow, such magic"
db.store([testScene])
@barcharcraz
barcharcraz / nimql.nim
Created February 2, 2017 05:39
nimql!
import db_sqlite
proc ql_convert(typ: typedesc[int64], stm: PStmt, column: int32): int64 = column_int64(stm, column)
nimqlgen()
var db = open("testdb.sqlite", "", "", "")
for row in db.row_iter("SELECT id, value1 FROM test1"):
echo row.id
echo row.value1

Keybase proof

I hereby claim:

  • I am barcharcraz on github.
  • I am bartoc (https://keybase.io/bartoc) on keybase.
  • I have a public key ASDpummMuNSeaMd5BvLMtARq8BqaruXsQLqPie30T71giAo

To claim this, I am signing this object:

Build started at 2017-12-15T14:09:49.418983
Python binary: c:\users\<me>\appdata\local\programs\python\python36\python.exe
Python system: Windows
The Meson build system
Version: 0.43.0
Source dir: C:\Users\<me>\Documents\source\test
Build dir: C:\Users\<me>\Documents\source\test\builddir
Build type: native build
Project name: test
Sanity testing C compiler: cl