Skip to content

Instantly share code, notes, and snippets.

View marvhus's full-sized avatar
🎯
Focusing

Martin marvhus

🎯
Focusing
View GitHub Profile
@yasinkaraaslan
yasinkaraaslan / first.jai
Last active May 31, 2025 16:14
Jai Metaprogram for Linking with RAD Linker
LINKER_FILE_NAME :: "radlink.exe";
#run build();
build :: () {
set_build_options_dc(.{do_output=false});
set_working_directory(#filepath);
options := get_build_options();
options.output_type = .EXECUTABLE;
options.output_executable_name = "My Executable";
options.output_path = "./build/";
@LainLayer
LainLayer / jai.yaml
Created May 22, 2025 15:08
Jai syntax highlighting for micro
filetype: jai
detect:
filename: "(\\.(jai)$)"
rules:
- identifier: "\\b[A-Z_][0-9A-Z_]+\\b"
# This highlights PascalCase or Ada_Case types as types.
# Jai does not enforce any code styles, so this is not part of the language
@randyprime
randyprime / entity_structure.odin
Last active May 15, 2025 15:21
ENTITY MEGASTRUCT
// the tl;dr -> https://storage.randy.gg/entity%20midwit.png
/*
ENTITY MEGASTRUCT
by randy.gg
This is an extremely simple and flexible entity structure for video games that doesn't make you want to
die when you're 20k lines deep in a project.
/*
The purpose of this plugin is to disable certain procedures that are intended to be
developer-only secret code that you don't want to end up in the final release build
of your program.
To use this plugin, compile your program with `jai main.jai -plug Developer_Only`
and then mark certain procedures with the `@Developer` note. These procedures will
have their body deleted when in developer builds.
hljs.registerLanguage("jai", function(e) {
return {
aliases: ["jai"],
keywords: {
keyword: "xx break case continue defer else enum enum_flags for if return struct type_of union using inline no_inline push_context remove ifx then interface operator",
literal: "true false null",
},
illegal: "</",
contains: [
#import "Basic";
#import "Compiler";
#import "Hash_Table";
get_plugin :: () -> *Metaprogram_Plugin {
p := New(Metaprogram_Plugin);
p.message = message;
return p;
}
@marvhus
marvhus / README.md
Last active April 23, 2024 18:51
Floating Point Precision in x86-64 Assembly

Floating Point Precision in x86-64 Assembly

The lack of precison you get with floating point numbers isn't a language problem, it's a problem with floating point nubers themselves, so it even shows up as low as x86-64 assembly.

The assembly in the file bellow is the code I have written to showcase this.

To compile it you have to do this:

$ nasm floats.asm -o floats.o -f elf64
@sortofsleepy
sortofsleepy / OdinWebAssemblyBasic.md
Last active March 10, 2025 03:19
Odin language simple WebAsembly setup

Have some free time on my hands so I thought I'd try out Odin, an interesting language I came across a few weeks ago. I haven't dived too far into it but so far from what I understand, it's another language in a similar vain of Rust and Zig(both also very good)

Since as far as I can tell, though Odin does support WebAssembly, how specifically to build for it is not well documented so I thought I should post a very basic setup for WebAssembly.

All the Odin app does is

  • export a function that called setup that calls an imported JS function getWindowWidth
  • In the JS, it calls setup and logs the result.

When building the Odin code, the command is roughly odin build -target="js_wasm32" -out=""

@jdah
jdah / network_demo.c
Created January 31, 2024 14:22
the world's most basic client/server
#include <stdio.h>
#include <string.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <netdb.h>
#include <unistd.h>
static void server() {
// create socket
instance_id=0a087eb5
installation_name=VisualStudio/14.37.32822
installation_path=C:\MSVC
installation_version=14.37.32822
display_name=Visual Studio Community 2022
display_desc=Powerful IDE, free for students, open-source contributors, and individuals
sdk_version=10.0.22000.0
sdk_path=C:\MSVC\Windows Kits\10