Skip to content

Instantly share code, notes, and snippets.

View ssteinbach's full-sized avatar
😀
hello

Stephan Steinbach ssteinbach

😀
hello
View GitHub Profile
@ssteinbach
ssteinbach / readme.txt
Created January 31, 2024 21:17
Shifter Test (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
@ssteinbach
ssteinbach / readme.txt
Created January 10, 2024 06:48
Shifter Test (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
@ssteinbach
ssteinbach / readme.txt
Last active January 10, 2024 06:56
Shifter Test (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
@ssteinbach
ssteinbach / playdate_json_serializer.zig
Created August 2, 2023 04:34
Zig based JSON serializer/deserializer for Playdate
/// Module that wraps up the zig json system for use in playdate
const std = @import("std");
const pdapi = @import("playdate_api_definitions.zig");
pub fn read_from_json_str(
input: []const u8,
comptime thing_to_read: type,
allocator: std.mem.Allocator,
) !thing_to_read
@ssteinbach
ssteinbach / struct_ui.zig
Created July 28, 2023 03:34
Automatic ZGui UI From Struct
/// function for automatically building an imgui (via zgui) UI based
/// on struct fields. Really useful when you're moving quickly and
/// have a debug flags/fields struct
pub fn draw_zgui_ui(
for_thing: anytype
) !bool
{
var buf:[1024:0]u8 = undefined;
@memset(&buf, 0);
@ssteinbach
ssteinbach / build.zig
Last active July 3, 2023 03:00
Experimental build.zig for opentime
const std = @import("std");
const c_args = [_][]const u8{
"-std=c++17",
"-fno-sanitize=undefined",
};
// Although this function looks imperative, note that its job is to
// declaratively construct a build graph that will be executed by an external
// runner.
@ssteinbach
ssteinbach / zero_terminated_strings.zig
Created June 11, 2023 23:01
Explorations with 0 terminated buffers & strings in zig
const std = @import("std");
fn print_string_contents(buffer: anytype) void {
std.debug.print("string print: '{s}'\n", .{ buffer });
std.debug.print("char print:\n", .{});
for (buffer) |b, ind| {
std.debug.print(" {d}: {d} {s}", .{ ind, b, buffer[ind..ind+1] });
}
@ssteinbach
ssteinbach / zig_test_package.md
Last active October 21, 2022 16:27
Testing zig files in packages/subdirectories

Testing Zig Files in Packages/Subdirectories

Given a zig file file_with_test.zig in a subdirectory:

.
├── example_package
│   └── file_with_test.zig
└── outer_thing.zig
@ssteinbach
ssteinbach / zig_array_struct.md
Last active October 3, 2022 21:06
Zig - struct with array slice member to be initialized later

Zig: Struct with Array Slice field

One pattern that seems to fall out of my brain when I return to Zig is having a struct with one array field that I want to assign to later. For example:

const StateData = struct {
  // I realize this is wrong, this is what my brain always wants to try first
  order: []burger=undefined,
};
@ssteinbach
ssteinbach / adapter_arg_discovery.md
Last active September 28, 2022 17:17
Discovering OTIO Adapter Arguments

Discovering OTIO Adapter Arguments

Overview

The otioconvert program that ships with OpenTimelineIO has a handy feature that lets you pass arguments to adapters:

> otioconvert --help
...
 -a ADAPTER_ARG, --adapter-arg ADAPTER_ARG