Skip to content

Instantly share code, notes, and snippets.


Steve Vermeulen svermeulen

View GitHub Profile
View Teal OOP example
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
View gist:2ebe995ad7e398dc7c707a1be0c87674
local record IFoo
bar: function(self:IFoo, integer):integer
local record Foo1
bar: function(integer):integer
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
View MoonScriptLineNumberMap.moon
-- 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 / 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 January 29, 2020 11:42
Python LINQ equivalents
def assert_throws(func):
except Exception:
return True
return False
def test_empty():
svermeulen / gist:996213b4c6747c8c20f5a498ca67f932
Last active March 3, 2019 01:52
Hammerspoon to reload karabiner (12.2.0) complex modification. NOTE: Assumes 1 entry and that it's listed at the top in the add popup
View gist:996213b4c6747c8c20f5a498ca67f932
hs.urlevent.bind("reloadKarabinerConfig", function(eventName, params)
local delay = 10
hs.timer.doAfter(1, function()
-- Select the complex modifications tab
hs.eventtap.keyStroke({}, "right", delay)
hs.eventtap.keyStroke({}, "right", delay)
hs.timer.doAfter(1, function()
View ZenjectSceneLoader.cs
using System;
using System.Collections;
using UnityEngine.SceneManagement;
using UnityEngine;
using ModestTree;
namespace Zenject
svermeulen / InheritanceExample.lua
Created July 26, 2017 19:18
Lua OOP Inheritance Demo
View InheritanceExample.lua
Base = {}
function Base:new()
local obj = {foo = 'asdf'}
return setmetatable(obj, { __index = self })
function Base:run()
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
View Ref.cs
public class Ref<T> where T: struct
T _value;
public Ref(T value)
_value = value;
public T Value