Skip to content

Instantly share code, notes, and snippets.

View createdbyx's full-sized avatar

Dean Lunz createdbyx

View GitHub Profile
@createdbyx
createdbyx / NET6ExecuteC#CodeInSeparateContextAndUnload.cs
Last active January 4, 2023 10:32
Simple bare bones example of how to execute C# code in your app under a separate context for plugins and dispose when done
private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
{
// setup the wrapper code template.
var generatedCode =
"using LiveCodeExecutionExampleDemo;" + Environment.NewLine +
"public class Plugin" + Environment.NewLine +
"{" + Environment.NewLine +
" public void RunCode(AppModel app)" + Environment.NewLine +
" {" + Environment.NewLine +
$"{this.CodeEditor.Text}" +
@createdbyx
createdbyx / Find Unpublished Git Repos.ps1
Created April 7, 2022 09:42
provides a breakdown of git repos in the current path
class GitData
{
[string]$Folder
[string]$Branch
[int]$Modifications
[int]$Additions
[int]$Deletions
[int]$Untracked
[int]$Renamed
}
@createdbyx
createdbyx / Options.cs
Created April 30, 2020 02:52
Visual studio post build command line arguments for https://github.com/commandlineparser/commandline
public class Options
{
[Option('o', nameof(vs_OutDir), Required = false, HelpText = "Specifies project out directory.")]
public string vs_OutDir
{
get; set;
}
[Option('c', nameof(vs_ConfigurationName), Required = false, HelpText = "Specifies the configuration name.")]
public string vs_ConfigurationName
/*
Copyright 2013 Christoph Gattnar
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@createdbyx
createdbyx / TextAreaTabSupportSimplified.cs
Created February 8, 2016 16:14
Simplified example of adding Tab key support to a Unity3D TextArea
using System;
using UnityEditor;
using UnityEngine;
public class TextAreaTabSupport : EditorWindow
{
private int lastKBFocus = -1;
private string textA = string.Empty;
@createdbyx
createdbyx / TextAreaTabSupport.cs
Last active February 8, 2016 16:11
More advanced example of adding Tab key support to a Unity3D TextArea
using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
public class TextAreaTabSupport : EditorWindow
{
private Vector2 scroll;
@createdbyx
createdbyx / ContinuationManager
Created November 24, 2015 09:31
Provides a simulated multithreading manager for invoking callbacks on the main unity thread.
using System;
using System.Collections.Generic;
using System.Threading;
using UnityEditor;
/// <summary>
/// Provides a simulated multithreading manager for invoking callbacks on the main unity thread.
/// </summary>
public static class ContinuationManager
@createdbyx
createdbyx / IdManager.cs
Last active November 26, 2015 11:55
removed reliance on Linq
// <copyright>
// Copyright (c) 2012 Codefarts
// All rights reserved.
// contact@codefarts.com
// http://www.codefarts.com
// </copyright>
namespace Codefarts.IdManager
{
using System;
@createdbyx
createdbyx / gist:a58a826777421d90a86b
Last active August 29, 2015 14:14
Constructs a nested hierarchy of types from a flat list of source types. (without recursive calling)
/*
Sample use case ...
class Program
{
static void Main(string[] args)
{
var paths = new[]
{
"assets/folder",
"assets/folder/filea.txt",
using System;
namespace GeneticAlgorithm
{
/// <summary>
/// Genetic Algorithm class
/// </summary>
public class GA
{
private double _totalFitness;