Skip to content

Instantly share code, notes, and snippets.

@DGriffin91
DGriffin91 / main.rs
Created September 11, 2021 01:51
Return a slice from a function defined in cranelift that calls a rust function that returns a slice
/*
[dependencies]
cranelift = "0.76.0"
cranelift-module = "0.76.0"
cranelift-jit = "0.76.0"
*/
use cranelift::{
codegen::{ir::immediates::Offset32, ir::ArgumentPurpose, Context},
prelude::*,
@DGriffin91
DGriffin91 / main.rs
Last active September 11, 2021 00:34
Return a slice from a function defined in cranelift
/*
[dependencies]
cranelift = "0.76.0"
cranelift-jit = "0.76.0"
cranelift-module = "0.76.0"
*/
use cranelift::{
codegen::{
self,
@DGriffin91
DGriffin91 / main.rs
Last active September 9, 2021 23:50
Load & Store slice cranelift
/*
[dependencies]
cranelift = "0.76.0"
cranelift-jit = "0.76.0"
cranelift-module = "0.76.0"
*/
use cranelift::{
codegen::{
self,
@DGriffin91
DGriffin91 / main.rs
Last active September 5, 2021 19:54
Setup cranelift to build a function that calls a rust function
/*
[dependencies]
cranelift = "0.76.0"
cranelift-module = "0.76.0"
cranelift-jit = "0.76.0"
*/
use cranelift::{codegen::Context, prelude::*};
use cranelift_jit::{JITBuilder, JITModule};
use cranelift_module::{FuncId, Linkage, Module};
@DGriffin91
DGriffin91 / jsfx
Created August 17, 2021 18:35
Varb
desc: Varb 0.1 (DG)
slider1:0.5<0.0,1.0>Mix
slider2:0.2<0.0,1.0>Delay Size
slider4:0.9<0.6,1.5>Delay Delta
slider6:0.9<0.0,1.5>Decay Init
slider7:1.0<0.5,1.5>Decay Delta
slider11:16.0<0.0,64.0,1.0>Iterations
//! Barebones baseview imgui plugin
#[macro_use]
extern crate vst;
use imgui::*;
use baseview::AppRunner;
use raw_window_handle::RawWindowHandle;
use vst::buffer::AudioBuffer;
@DGriffin91
DGriffin91 / main.rs
Created August 19, 2020 03:21
Despawn panic test
use bevy::prelude::*;
pub struct Game;
struct Box(u8);
struct AddBoxEventTriggerState {
event_timer: Timer,
}
impl Default for AddBoxEventTriggerState {
@DGriffin91
DGriffin91 / simple_imgui_example.py
Last active June 13, 2025 03:23
A simple pyimgui example using the GLFW backend
#pip install imgui[glfw]
import imgui
import glfw
import OpenGL.GL as gl
from imgui.integrations.glfw import GlfwRenderer
def impl_glfw_init(window_name="minimal ImGui/GLFW3 example", width=1280, height=720):
if not glfw.init():
print("Could not initialize OpenGL context")