All New

user:thomas gists created by user

title:mygist gists with given title

filename:myfile.txt gists having files with given name

extension:yml gists having files with given extension

language:go gists having files with given language

topic:homelab gists with given topic

Register

Login


All New Register Login

All gists

Recently created
Least recently created
Recently updated
Least recently updated
capitalex's Avatar

capitalex / prefix-stack.lua

0 likes
0 forks
2 files
Last active 1 month ago
1 local Object = require "object"
2
3
4 --[[
5 Prefix Tree Stack preserves the insertion order
6 of the items being added. This can create duplicate
7 branches when a normal prefix tree wouldn't have it
8
9 Insertion Operations:
10 insert apple
june's Avatar

june / game.nv

0 likes
0 forks
1 files
Last active 2 months ago
1 ||:@include: lib/math.nv
2
3 | :enemies: spawn enemies |
4 :enemies: automaton hp 10
5 :enemies: slime hp 4
6 :enemies: skeleton hp 5
7
8 |# handle player stats #|
9 || :player atk: 1
10 | :equipped: sword? :player atk: 1|
june's Avatar

june / rejoice-fizzbuzz.nv

0 likes
0 forks
1 files
Last active 2 months ago
1 ||:FizzBuzz:
2
3 |# Just a quick hack, for serializing the output... #|
4 |:print-fb:| :output: FizzBuzz
5 |:print-f:| :output: Fizz
6 |:print-b:| :output: Buzz
7
8 |:FizzBuzz:| :: r1
9 |:: r1|
10 :i: :i: :f: :b:
yumaikas's Avatar

yumaikas / fpc.zig

0 likes
0 forks
1 files
Last active 2 months ago
1 const std = @import("std");
2
3 pub fn main() !void {
4 var gpa = std.heap.GeneralPurposeAllocator(.{}).init;
5 defer _ = gpa.deinit();
6 const alloc = gpa.allocator();
7
8 // Using this for cross-platform suitability
9 const argv = try std.process.argsAlloc(alloc);
10 defer std.process.argsFree(alloc, argv);
yumaikas's Avatar

yumaikas / chalk.js

0 likes
0 forks
3 files
Last active 2 months ago
1 globalThis.test = (suite, tests) => {
2 process.stdout.write(suite + ": ");
3 for (const [name, t] of Object.entries(tests)) {
4 try {
5 t();
6 process.stdout.write(".");
7 } catch(ex) {
8 console.error("In " + suite +", test " + name + " failed:", ex)
9 }
10 }
june's Avatar

june / Stored Tasks

0 likes
0 forks
1 files
Last active 2 months ago
Store, recall and execute tasks in Nova.
1 ||:: task foo
2 :: do something
3 :: do another thing
4 :: do yet another thing
5 :: end task
6 :: task bar
7 :: do another thing
8 :: do something
9 :: do yet another thing
10 :: end task
june's Avatar

june / Accounting Mocks

0 likes
0 forks
1 files
Last active 2 months ago
An example of turning pseudocode into a functional model.
1 |# First, we need to import conditional statements. #|
2 ||'@include' https://gist.nouveau.community/june/72f7794abbf64eb3890e2715d7e7789b/raw/HEAD/conditional.nv
3
4 |# Let's try something. #|
5 ||:: test the happy path
6 :: log in as june
7 :: transfer 100 from 1234 to 5678
8 :: log out
9
10 ||:: test the sad path
june's Avatar

june / Conditional Logic

0 likes
0 forks
1 files
Last active 2 months ago
If/else statements, implemented in Nova.
1 ||:@control.enabled:
2
3 || :@control.if: if
4 || :@control.then: then
5 || :@control.end: end
6 || :@control.else: else
7 || :@control.fail: fail
8 | :@control.enabled:?
9 :@control.fail: $fail?
10 :@control.then: $then?
june's Avatar

june / Multiple State Machines

0 likes
0 forks
1 files
Last active 2 months ago
An example of turning an isolated state machine into multiple.
1 |# A turnstile, a state machine. #|
2
3 |:state: locked :action: push| :state: locked
4 |:state: locked :action: coin| :state: un-locked
5
6 |:state: un-locked :action: push| :state: locked
7 |:state: un-locked :action: coin| :state: un-locked
8
9
june's Avatar

june / Menu System

0 likes
0 forks
1 files
Last active 2 months ago
A small menu system with configurable actions.
1 ||:: set up the menus
2 :: run the test
3
4 |:: set up the menus|
5 :: define menu title-screen
6 :: start -> switch-menu
7 :: options -> switch-menu
8 :: quit -> quit-game
9 :: end menu
10 :: define menu start
Newer Older

Powered by Opengist ⋅ Load: 207ms⋅

English
Čeština Deutsch English Español Français Magyar Italiano 日本語 Polski Português Русский Türkçe Українська 中文 繁體中文