Skip to content

Instantly share code, notes, and snippets.

type Test = tuple
x, y: int
const size = sizeof(Test) # Error: cannot evaluate 'sizeof(Test)'
echo size
{.experimental.}
type TArray {.borrow: `[]`.} = distinct array[0..3, int]
var a = TArray([1, 2, 3, 4])
echo "yay", a[1] # Error: type mismatch: got (TArray, int literal(1))
{.experimental.}
type Blah = distinct string
template `[]`*(a: Blah, indexList: varargs[int]): expr =
1212
var a : Blah
echo a[1,2,3,4,5,6,7,8,9]
{.experimental.}
import sequtils, unittest as unittest
type arrayUnchecked {.unchecked.} [T] = array[0..0, T]
type memory[T] = ptr arrayUnchecked[T]
let intCount = 10
let floatCount = 20
{.experimental.}
type arrayUnchecked {.unchecked.} [T] = array[0..0, T]
type MatD[ElementT] = object
n: int
m: int
data: ptr arrayUnchecked[ElementT]
template matD(nv,mv: int, elementT: typedesc = float64): expr =
type MatD[ElementT] = object
n: int
m: int
#data:
#template matD(n,m: int, elementT: typedesc = float64): expr =
# MatD[elementT](n: n, m: m)
template matD(nv,mv: int, elementT: typedesc = float64): expr =
MatD[elementT](n: nv, m: mv)
@Deco
Deco / keybase.md
Created November 3, 2014 11:32
keybase.md

Keybase proof

I hereby claim:

  • I am Deco on github.
  • I am deco (https://keybase.io/deco) on keybase.
  • I have a public key whose fingerprint is 1AA1 FD64 931F 5345 28C2 0BEF A31B 6B59 C9FD A4BF

To claim this, I am signing this object:

@Deco
Deco / 1-hook.sh
Last active August 29, 2015 13:57
Git warning on requirements.txt change (save as ".git/hooks/post-merge" and run "chmod +x .git/hooks/post-merge")
#!/bin/bash
set -eu
git diff "HEAD@{1}" --name-only | grep requirements.txt 2>&1 > /dev/null
CHANGED=$?
if [ $CHANGED ]; then
echo
echo -e "\e[41m!!! requirements.txt HAS CHANGED !!!\033[0m"
echo
// ======= Copyright (c) 2003-2011, Unknown Worlds Entertainment, Inc. All rights reserved. =======
//
// lua\GUIProtoBuyMenu.lua
//
// Created by: Andreas Urwalek (andi@unknownworlds.com)
//
// Manages the marine buy/purchase menu.
//
// ========= For more information, visit us at http://www.unknownworlds.com =====================
GUIProtoBuyMenu.kExoButtonMaps = {
leftArm = {
{ // remember this means [1] =
id = "claw",
label = "Claw",
powerCost = 5,
buttonImages = {
disabled = "materials/...",
normal = "materials/...",
selected = "materials/...",