Skip to content

Instantly share code, notes, and snippets.

View gist:5588752a880f054c28b2
type Test = tuple
x, y: int
const size = sizeof(Test) # Error: cannot evaluate 'sizeof(Test)'
echo size
View gist:5a58b5721bec07c4b09a
{.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))
View gist:8de65dfde6fba26e74ee
{.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]
View gist:850e3e8f05cb0495588a
{.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
View gist:9b249f8de80d07dfe4c6
{.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 =
View gist:6dbc81ae3e05e038792d
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)
View 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 Aug 29, 2015
Git warning on requirements.txt change (save as ".git/hooks/post-merge" and run "chmod +x .git/hooks/post-merge")
View 1-hook.sh
#!/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
View gist:8896650
// ======= 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 =====================
View gist:8894234
GUIProtoBuyMenu.kExoButtonMaps = {
leftArm = {
{ // remember this means [1] =
id = "claw",
label = "Claw",
powerCost = 5,
buttonImages = {
disabled = "materials/...",
normal = "materials/...",
selected = "materials/...",