Skip to content

Instantly share code, notes, and snippets.

- platform: gpio
id: button
pin: XX
on_click:
- min_length: 0 s
max_length: 1 s
then: // Actions for short click
- platform: template
id: button_longpress
condition:
1 | const std = @import("std");
2 | const rl = @import("raylib");
3 | const cl = @import("zclay");
4 | const renderer = @import("raylib_render_clay.zig");
5 | const math = std.math; // Import math for ceil
6 | const fmt = std.fmt; // Import fmt for string formatting
7 |
8 | const light_grey: cl.Color = .{ 224, 215, 210, 255 };
9 | const red: cl.Color = .{ 168, 66, 28, 255 };
10 | const orange: cl.Color = .{ 225, 138, 50, 255 };
@raspberrypisig
raspberrypisig / tagged_unions.zig
Created April 19, 2025 23:57 — forked from SpexGuy/tagged_unions.zig
Zig: Using tagged unions to make a simple json formatter
const JsonString = struct {
value: []const u8,
};
const JsonNumber = struct {
value: f64,
};
const JsonObject = struct {
const Property = struct {
name: []const u8,
value: JsonValue,
param(
[string[]]$Arguments
)
$OriginalPWD=$PWD
# Define the path to the Sublime Text directory
$SublimePath = "C:\Program Files\Sublime Text"
# Define the path to the Sublime Text executable
$utilsList = @(coreutils --list)
Foreach ($util in $utilsList) {
$util_path = ( -join (".\", $util, ".exe"))
New-Item -ItemType SymbolicLink -Path $util_path -Target "C:\Users\Mohan\AppData\Local\Microsoft\WinGet\Packages\uutils.coreutils_Microsoft.Winget.Source_8wekyb3d8bbwe\coreutils-0.0.30-x86_64-pc-windows-msvc\coreutils.exe"
# -*- mode: justfile -*-
# ==============================================================================
# Settings - Control Just's behavior
# ==============================================================================
# Set the shell used to execute recipes. Array form is recommended.
# -u: Treat unset variables as an error.
# -c: Read commands from string.
set shell := ["bash", "-uc"]
const std = @import("std");
const json = std.json;
const Allocator = std.mem.Allocator;
const StringHashMap = std.StringHashMap;
const ArrayList = std.ArrayList;
// --- Data Structures Mirroring JSON Schema ---
// Corresponds to TypeScript's ParameterKind
pub const ParameterKind = enum {
pub fn main() !void {
// const justfile = try std.fs.cwd().openFile("justfile.json", .{});
// var buffer: [3000]u8 = undefined;
// const bytes_read = try justfile.readAll(&buffer);
// const content = buffer[0..bytes_read];
// const stdout = std.io.getStdOut().writer();
// var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init;
// defer _ = gpa.deinit();
// const allocator = gpa.allocator();
// var parsed = try std.json.parseFromSlice(std.json.Value, allocator, content, .{ .allocate = .alloc_always });