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
def display_hint(value): | |
return 'string' | |
def to_string(value): | |
if value: | |
l = int(value['Sup']['len']) | |
return value['data'][0].address.string("utf-8", "ignore", l) | |
else: | |
return "" |
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
/* Generated by Nim Compiler v1.1.1 */ | |
/* (c) 2019 Andreas Rumpf */ | |
/* The generated code is subject to the original license. */ | |
/* Compiled for: MacOSX, amd64, clang */ | |
/* Command for C compiler: | |
clang -c -w -I/usr/local/Cellar/nim/HEAD-81a4379/nim/lib -I/Users/csweetser/Personal -o /Users/csweetser/.cache/nim/untitled_d/@muntitled.nim.c.o /Users/csweetser/.cache/nim/untitled_d/@muntitled.nim.c */ | |
#define NIM_INTBITS 64 | |
#include "nimbase.h" | |
#include <string.h> |
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
proc copy[T](d: T): T = | |
when T is ref: | |
# return a new reference that is a copy (though not a deep copy) of T | |
else: | |
return d # regular object copy logic | |
proc processData[T](data: T): T = | |
result = copy(data) | |
sort(result) | |
trim(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
iterator foo(a, b: int): int | |
iterator foo(a, b: int): int = | |
for x in a..b: | |
yield x |
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
var s = @["here", "there", "everywhere"] | |
proc foo(s: var seq[string], s2: var string) = | |
echo "1 ", repr(s) | |
echo "2 ", s2 | |
s[^1] = "when" | |
s2.add("this") | |
s.setLen(2) | |
s2.add("yes") | |
echo "3 ", repr(s) |
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 npeg | |
let parser = peg "COMMANDS": | |
COMMANDS <- COMMAND * *( SEPERATOR_SYM * COMMAND ) | |
COMMAND <- +( | |
SPACES | | |
REDIRECT_SYM | | |
COMMAND_SUB | | |
VARIABLE_SUB | | |
DQ_STRING_LIT | |
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 | |
User = ref object | |
id: int | |
cParent: User | |
template parent(target: typed): untyped = | |
when type(target) is User: | |
if isNil(target.cParent): | |
target.cParent = await loadParent(target) |
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 strutils | |
import tables | |
import algorithm | |
import httpcore | |
import unicode | |
import strformat | |
import times | |
import nimcrypto | |
import httpclient | |
import utils |
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
@echo off | |
set the32bitProgram="typedef int is32bit[sizeof(void*) == 32 ? 1 : -1];" | |
set the64bitProgram="typedef int is32bit[sizeof(void*) == 64 ? 1 : -1];" | |
rem Use "|| goto :error" after commands that can fail to invoke the error | |
rem handler. | |
goto :after_error | |
:error |
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 pegs | |
let p = peg""" | |
function_call <- \ident '(' parameters ')' | |
parameters <- (parens / string / [^)] )* | |
parens <- '(' parameters ')' | |
string <- dq_string / sq_string | |
dq_string <- DQUOTE (BSLASH . / [^DQUOTE])* DQUOTE | |
sq_string <- SQUOTE (BSLASH . / [^SQUOTE])* SQUOTE |