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
const std = @import("std"); | |
pub fn SwitchJoiner(comptime T: type, comptime Tuple: type) fn (values: Tuple) T { | |
return struct { | |
fn switchJoin(values: Tuple) T { | |
comptime var bit_size: usize = 0; | |
var res: T = 0; | |
inline for (values) |val| { | |
res |= @as(T, switch (@typeInfo(@TypeOf(val))) { |
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
const std = @import("std"); | |
/// Tracks types and returns unique IDs for them at compile time | |
/// | |
/// Takes a "unique" parameter to prevent Id types from being interchangeable | |
/// between different Typetrackers | |
pub fn Typetracker(comptime IntType: type, comptime unique: @TypeOf(opaque {})) type { | |
_ = unique; | |
return struct { | |
pub const Id = enum(IntType) { _ }; |
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
const std = @import("std"); | |
pub fn build(b: *std.Build) !void { | |
const target = b.standardTargetOptions(.{}); | |
const optimize = b.standardOptimizeOption(.{}); | |
const exe = b.addExecutable(.{ | |
.name = "sandbox", | |
.root_source_file = .{ .path = "src/main.zig" }, | |
.target = target, |
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
# 0 0 | |
# 0 1 | |
# 0 2 | |
# 0 3 | |
# 0 4 | |
# 1 1 | |
# 1 2 | |
# 1 3 | |
# 1 4 | |
# 2 2 |
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
document.write(`<iframe width="1519" height="529" src="https://www.youtube.com/embed/dQw4w9WgXcQ?autoplay=1" title="Rick Astley - Never Gonna Give You Up (Official Music Video)" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>`) |
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
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.3.1/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script> |