Skip to content

Instantly share code, notes, and snippets.

View dom96's full-sized avatar
🛤️

Dominik Picheta dom96

🛤️
View GitHub Profile
type
TPerson = object # I prepended a T because that is the Nimrod convention. It also gets rid of possible clashes, like in `$` :)
name*: string
age*: int
proc newPerson(name: string, age: int): TPerson =
result.name = name
result.age = age
proc `<=>`(person1: TPerson, person2: TPerson): bool =
import jester, strtabs
get "/":
@"<h1>Hello world</h1>"
get "/awesome":
@"<h1>Awesomness :D</h1>"
run()
import algorithm, strutils
proc cmpPlatforms(a, b: string): int =
if a == b: return 0
var dashes = a.split('-')
var dashes2 = b.split('-')
if dashes[0] == dashes2[0]:
if dashes[1] == dashes2[1]: return system.cmp(a,b)
case dashes[1]
of "x86":
proc addOne(n: var int) =
n += 1
var number = 0
number.addOne()
var L = d.delegates.len
var dc = 0
while dc < L:
template deleg: expr = d.delegates[dc]
let aSock = deleg.getSocket(deleg.deleVal)
if (deleg.mode != MWriteable and aSock.info == SockConnected) or
aSock.info == SockListening:
readSocks.add(aSock.sock)
if aSock.info == SockConnecting or
(aSock.info == SockConnected and deleg.mode != MReadable):
{ "black": [
"_? There's an app for that",
"Why can't I sleep at night? _",
"What's that smell? _",
"I got 99 problems but _ ain't one.",
"Who stole the cookies from the cookie jar? _",
"What's the next Happy Meal (r) toy? _",
"Anthropologists have recently discovered a primitive tribe that worships _.",
"It's a pity that kids these days are all getting involved with _.",
"During Picasso's often-overlooked Brown Period, he produced hundreds of paintings of _.",
# Compile with --threads:on
import math, os, strutils, osproc, locks
type
TComplex = tuple[re, im: float]
TThrParam = tuple[start, size, realsize, id: int]
var bytes: array[0..3, cstring]
var lengths: array[0..3, int]
> /home/dominik/code/outside/git/Nimrod/bin/nimrod c /home/dominik/code/nimrod/bugs/styleinsensitivity/test.nim
Hint: used config file '/home/dominik/code/outside/git/Nimrod/config/nimrod.cfg' [Conf]
Hint: system [Processing]
Hint: test [Processing]
test.nim(2, 5) Error: invalid token: _
> Process terminated with exit code 1
type
MyType = object
field: string,
exportedField*: int64
proc foo(arg: var MyType) =
arg.field = "bar"
when isMainModule():
echo("Hello")
#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#define BUF_SIZE (61)
LPCTSTR ErrorMessage( DWORD error )
// Routine Description:
// Retrieve the system error message for the last-error code