Skip to content

Instantly share code, notes, and snippets.

View svermeulen's full-sized avatar

Steve Vermeulen svermeulen

View GitHub Profile
@svermeulen
svermeulen / InheritanceExample.lua
Created July 26, 2017 19:18
Lua OOP Inheritance Demo
Base = {}
function Base:new()
local obj = {foo = 'asdf'}
return setmetatable(obj, { __index = self })
end
function Base:run()
print(self.foo)
end
@svermeulen
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
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
svermeulen / .cvimrc
Last active January 1, 2017 04:17
cVim Config
unmapAll
let scrollstep = 75
let barposition = "bottom"
let mapleader = ","
set typelinkhints
set numerichints
@svermeulen
svermeulen / cleverVariableArgs.vim
Created January 29, 2015 01:54
Clever alternative way of declaring optional parameters in vimscript
" Normal way of declaring variable arguments with default values:
function! ExampleFunc1(fix1, fix2, ...)
let var1 = a:0 > 0 ? a:1 : 'defaultVal1'
let var2 = a:0 > 1 ? a:2 : 5
echo a:fix1 .','. a:fix2 .','. var1 .','. var2
endfunction
" Alternative approach using a command:
@svermeulen
svermeulen / Completion.vim
Last active August 29, 2015 14:13
Vim Completion with 'jk'
let s:startedScrolling = 0
function! g:TriggerCompletion()
if pumvisible()
call s:OnStartScrolling()
return "\<C-n>"
endif
return ""
endfunction
@svermeulen
svermeulen / gist:6ad9cd812c306730376d
Created November 14, 2014 16:30
Zenject Compatible Coroutine Task Runner
public class AsyncTaskProcessor : ITickable
{
public event Action LoadStarted = delegate {};
public event Action LoadComplete = delegate {};
// New workers to prevent a process from being popped before completion
List<WorkerData> _newWorkers = new List<WorkerData>();
// We use a stack here because otherwise sub process of current workers would never execute
// causing a state of limbo.