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
// 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 |
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
open Stdlib | |
open Llvm | |
type literal = | |
| Int of int | |
| Bool of bool | |
| String of string | |
| Char of char |
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
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 { |
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"); | |
const ArgsKind = enum { | |
Foo, | |
Bar, | |
}; | |
fn GenArgs(comptime kind: ArgsKind) type { | |
return switch (kind) { | |
.Foo => struct { val: ?u8 }, |
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
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)); | |
} |
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
HtmlKind: Enum | |
Html, | |
Head, | |
Body, | |
Div, | |
Span, | |
H1, | |
H2, |
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
import SwiftUI | |
@main | |
struct SimpleApp: App { | |
var body: some Scene { | |
WindowGroup { | |
ContentView() | |
} | |
} | |
} |
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
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): |
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"); | |
const EleKind = enum { | |
NewDocument, | |
Html, | |
DocType, | |
Head, | |
Body, | |
Meta, | |
Link, |
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
# 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").} |
OlderNewer