This file contains 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
#!/usr/bin/env python | |
import json | |
import time | |
print "Loading and parsing json" | |
t1 = time.time() | |
j = json.load(open("nimrod_performance.json", "rt")) | |
print j["pak_filename"] | |
t2 = time.time() |
This file contains 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 json, times, strutils | |
when isMainModule: | |
echo "Loading and parsing json" | |
let t1 = epochTime() | |
let j = parseFile("nimrod_performance.json") | |
assert (j.kind == JObject) | |
let t2 = epochTime() | |
echo "Took ", formatFloat(t2 - t1, ffDecimal, 2) |
This file contains 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
## Convenience wrapper around raw `nimepak <nimepak.html>`_ module. | |
## | |
## The usual operation with these procs is to create a Tepak var and call | |
## init() on it to use it. You can call is_valid() at any time on a Tepak to | |
## check its validity. | |
import nimepak | |
export nimepak.F_BUF_SIZE | |
export nimepak.F_PACK_MAGIC |
This file contains 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 doc1*(text: string) = | |
## Blah blah blah the blah | |
## | |
## Blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah | |
## blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah | |
## blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah | |
## blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah | |
## blah blah blah blah blah blah blah blah blah blah blah blah | |
## | |
## Blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah |
This file contains 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 test1() = | |
raise newException(E_base, "Hey ho") | |
proc tester() = | |
except: echo "2. except block" | |
finally: echo "3. Finally block" | |
echo "1. Pre exception" | |
test1() | |
echo "NaN. Post exception" |
This file contains 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 | |
TNodeKind = enum PK_EMPTY, PK_INT, PK_STRING | |
TNode = object | |
case kind: TNodeKind | |
of PK_EMPTY: nil | |
of PK_INT: int_val: int | |
of PK_STRING: str_val: string | |
template new_node(kind: TNodeKind, expr): TNode {.immediate.} = |
This file contains 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 | |
Tparam_kind* = enum PK_EMPTY, PK_STRING | |
Tparsed_parameter* = object | |
case kind*: Tparam_kind | |
of PK_EMPTY: nil | |
of PK_STRING: str_val*: string | |
proc `$`*(data: Tparsed_parameter): string {.procvar.} = | |
case data.kind: |
This file contains 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 parse*(expected: seq[string] = @[], | |
bad_prefixes = @["-", "--"], end_of_parameters = "--", | |
quit_on_failure = true) = | |
nil | |
template tp(expected: seq[string] = @[], | |
bad_prefixes, end_of_parameters): expr = | |
parse(expected, | |
quit_on_failure = false, bad_prefixes = bad_prefixes, |
This file contains 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 | |
TKind1 = enum TK1A, TK1B | |
TKind2 = enum TK2A, TK2B | |
TKind3 = enum TK3A, TK3B | |
TK2 = object | |
case kind: TKind2 | |
of TK2A: tk2_int: int | |
of TK2B: tk2_string: string |
This file contains 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 "test.h" | |
#import "RestKit/RestKit.h" | |
@interface Root : NSObject | |
@property (nonatomic, strong) NSArray *users; | |
@property (nonatomic, strong) NSString *text; | |
@end | |
@implementation Root | |
- (NSString*)description { |
OlderNewer