Skip to content

Instantly share code, notes, and snippets.

@TheSantacloud
TheSantacloud / build.sh
Last active April 7, 2025 04:28
Build script for SwiftUI applications to be built on MacOS
#!/bin/sh
set -e
# if build directory doesn't exist, build first
if [ ! -d ".build" ]; then
swift build
fi
#
# get executable target name
@TheSantacloud
TheSantacloud / zig-0.13.0-builtins.csv
Created August 16, 2024 17:05
Zig built-ins cheatsheet 0.13.0
@addrSpaceCast(ptr: anytype) anytype Pointer conversion to another address space
@addWithOverflow(a: anytype, b: anytype) struct { @TypeOf(a, b), u1 } Addition with overflow detection
@alignCast(ptr: anytype) anytype Pointer alignment
@alignOf(comptime T: type) comptime_int Alignment for the current target in bytes
@as(comptime T: type, expression) T Safe type coercion
@atomicLoad(comptime T: type, ptr: *const T, comptime ordering: AtomicOrder) T Atomic dereference of pointer
@atomicRmw(comptime T: type, ptr: *T, comptime op: AtomicRmwOp, operand: T, comptime ordering: AtomicOrder) T Atomic modify and return previous value
@atomicStore(comptime T: type, ptr: *T, value: T, comptime ordering: AtomicOrder) void Atomic store of value at address
@bitCast(value: anytype) anytype Type cast at compile time
@bitOffsetOf(comptime T: type, comptime field_name: []const u8) comptime_int Bit offset of field within struct