Skip to content

Instantly share code, notes, and snippets.

View svermeulen's full-sized avatar

Steve Vermeulen svermeulen

View GitHub Profile
svermeulen / MultiSceneSetup.cs
Created October 23, 2016 17:32
Simple editor script to save and load multi-scene setups within Unity3D
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEditor.SceneManagement;
using UnityEditor;
using System.Collections;
using System.Linq;
public class MultiSceneSetup : ScriptableObject
svermeulen / Ref.cs
Created April 3, 2017 04:32
C# class to wrap convert value types to reference types by wrapping them in a reference type
public class Ref<T> where T: struct
T _value;
public Ref(T value)
_value = value;
public T Value
svermeulen / Cargo.toml
Last active January 4, 2024 12:25
Adding parent span id to tracing json in Rust
name = "foo"
edition = "2021"
version = "0.1.0"
authors = ["Steve Vermeulen <>"]
# See more keys and their definitions at
tracing = "0.1.40"
svermeulen /
Created November 9, 2023 12:50
Patches for piccolo project
pub fn index<'gc>(
ctx: Context<'gc>,
table: Value<'gc>,
key: Value<'gc>,
) -> Result<MetaResult<'gc, 2>, TypeError> {
let idx = match table {
Value::String(_) => match ctx.state.globals.get(ctx, "string") {
Value::Table(string_table) => {
let idx = if let Some(mt) = string_table.metatable() {
mt.get(ctx, MetaMethod::Index)
local record Class
__init:function(self:Class, ...:any)
function setup_as_class(class:Class, name:string):any
class.__name = name
class, {
__call = function(_, ...):any
svermeulen / gist:2ebe995ad7e398dc7c707a1be0c87674
Created April 14, 2022 00:34
Lua Teal Interface Example
local record IFoo
bar: function(self:IFoo, integer):integer
local record Foo1
bar: function(integer):integer
svermeulen / LICENSE
Last active September 15, 2021 15:13
MIT License
Copyright (c) 2021 Steven Vermeulen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
svermeulen /
Created August 22, 2021 11:02
Dataclass base class example
from jsonpickle.unpickler import loadclass
import jsonpickle
import typeguard # type: ignore
from dataclasses import is_dataclass
import inspect
# The entire purpose of this class is just to hook into the unpickle event
# so that we can call validate_member_types
# We want to be as strict as possible when deserializing
svermeulen / MoonScriptLineNumberMap.moon
Created February 13, 2021 16:58
How I map moon script line numbers to lua
-- TODO - instead of calculating this every time we should cache the map to file
class MoonScriptLineNumberMap
new: =>
@_fileMapMap = {}
@_jobManager = LazyResolve('JobManager')
_createFileMap: (moonPath) =>
lines = @_jobManager\executeAndWaitGetAllOutputLines("moonc -X '#{moonPath}'")
fileMap = {}
first = true
svermeulen /
Created January 29, 2020 11:42
Python LINQ equivalents
def assert_throws(func):
except Exception:
return True
return False
def test_empty():