Skip to content

Instantly share code, notes, and snippets.

View lantos1618's full-sized avatar
🐙
yeet

Lantos lantos1618

🐙
yeet
View GitHub Profile
// Import the required SDL2 and noise modules
use noise::{NoiseFn, Perlin, Simplex};
use sdl2::{event::Event, keyboard::Keycode, pixels::Color, rect::Point};
fn main() {
// Initialize the SDL2 library
let sdl_context = sdl2::init().unwrap();
let video_subsystem = sdl_context.video().unwrap();
// window width and height
@lantos1618
lantos1618 / main.ml
Created November 14, 2023 15:58
llvm ocaml
open Stdlib
open Llvm
type literal =
| Int of int
| Bool of bool
| String of string
| Char of char
@lantos1618
lantos1618 / main.rs
Created November 16, 2023 13:27
WORKING FRIB
use inkwell::builder::Builder;
use inkwell::context::Context;
use inkwell::execution_engine::ExecutionEngine;
use inkwell::module::Module;
use inkwell::values;
use inkwell::IntPredicate;
use inkwell::OptimizationLevel;
use std::error::Error;
pub enum Literal {
@lantos1618
lantos1618 / FunctionGeneration.zig
Created November 18, 2023 09:16
Dynamic function generation in zig
const std = @import("std");
const ArgsKind = enum {
Foo,
Bar,
};
fn GenArgs(comptime kind: ArgsKind) type {
return switch (kind) {
.Foo => struct { val: ?u8 },
@lantos1618
lantos1618 / dump.zig
Created November 19, 2023 12:27
dumping zig fields
fn Dump(args: anytype) void {
const ArgsType = @TypeOf(args);
const Args = @TypeOf(args);
std.debug.print("args: {}\n ArgsType: {}\n Args: {}\n", .{ args, ArgsType, Args });
const args_type_info = @typeInfo(ArgsType);
if (args_type_info != .Struct) {
@compileError("expected tuple or struct argument, found " ++ @typeName(ArgsType));
}
@lantos1618
lantos1618 / test.coffee
Last active December 16, 2023 18:04
brain dump
HtmlKind: Enum
Html,
Head,
Body,
Div,
Span,
H1,
H2,
@lantos1618
lantos1618 / view.swift
Created December 26, 2023 14:40
a view in swift
import SwiftUI
@main
struct SimpleApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
@lantos1618
lantos1618 / htmx.py
Created December 26, 2023 15:13
Htmx in python
from enum import Enum
from typing import Dict, List, Optional, Callable, Any, Type, TypeVar, Union
from enum import Enum
from typing import Union
from typing_extensions import Self
import inspect
from dataclasses import dataclass
class Tag(Enum):
@lantos1618
lantos1618 / htmx.zig
Created December 26, 2023 15:14
htmx in zig
const std = @import("std");
const EleKind = enum {
NewDocument,
Html,
DocType,
Head,
Body,
Meta,
Link,
@lantos1618
lantos1618 / llvm.nim
Created December 27, 2023 21:17
nim llvm
# this is just an example to get you started. a typical library package
# exports the main api in this file. note that you cannot rename this file
# but you can remove it if you wish.
# import trash_nim/submodule
# import llvm/core
import sequtils, options
# {.passc: gorge(" llvm-config --cflags").}