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
# Copyright 2020 by Joshua "Skrylar" Cearley, | |
# Available under the Mozilla Public License, version 2.0, | |
# https://www.mozilla.org/en-US/MPL/2.0/ | |
import macros | |
import strformat | |
import sugar | |
macro make_postbox*(name, body: untyped): untyped = | |
# validate body of our macro |
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
# TODO protect fields with inline procs that should get optimized out in release builds, but in debug builds can do asserts to make sure you unlocked it first | |
import opengl | |
import macros | |
import skyhash/xxhash | |
import sklog | |
type | |
TextureParameterBrush* = object | |
xhash*: uint64 |
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
#- = Making a stack-based parameter system | |
#- | |
#- I wanted to know how `chronicle` 's stack-based parameter system for | |
#- logs could work. So I pulled this out of a description of it on their | |
#- README. No spoilers were read beforehand. | |
#- | |
#- Here's how it works: | |
#- | |
#- . Marker objects are defined to hold information relevant from that | |
#- level of the stack downward. |
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 printingpress | |
import skmap/robin | |
import math | |
type | |
FlowDirection* = enum | |
LeftToRight | |
TopToBottom |
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
from math import sqrt | |
from tqdm import tqdm | |
from random import random | |
import matplotlib | |
from matplotlib import pyplot as plt | |
point_count = 20 | |
zoop = [0]*2048 | |
points = [0]*point_count |
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 libcurl | |
const | |
feed = "https://feeds.feedburner.com/breitbart?format=xml" | |
var downloaded = newstringofcap(1024) | |
proc onwrite(buffer: cstring; size, nitems: int; outstream: pointer): int = | |
let total = size * nitems | |
for i in 0..<total: | |
downloaded.add buffer[i] |
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
# not sure why this isn't built-in | |
template inc(self: var float; other: float) = | |
self = self + other | |
type | |
Averager* = object | |
count: int | |
x: float | |
proc feed*(self: var Averager; value: float) = |
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
var cobweb = Cobweb() | |
cobweb.def_root(inflation, float) | |
cobweb.def_root(monies, float) | |
cobweb.def_root(transhumanity, bool) | |
cobweb.def rich, bool: | |
result(monies): | |
monies > 1000000 |
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 macros | |
macro fsm*(name, definition: untyped): untyped = | |
echo treeRepr definition | |
fsm butt: | |
# default actions are taken when getting an input without that state | |
# knowing what to do about it | |
default: |
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(input: string) = | |
var i = 0 | |
template getch(): char = | |
if i > input.high: | |
break | |
inc i | |
input[i-1] | |
NewerOlder