Skip to content

Instantly share code, notes, and snippets.

View AnsisMalins's full-sized avatar

Ansis Māliņš AnsisMalins

View GitHub Profile
@AnsisMalins
AnsisMalins / onename.txt
Created March 27, 2016 18:42
onename verification
Verifying that +ansismalins is my blockchain ID. https://onename.com/ansismalins

Keybase proof

I hereby claim:

  • I am ansismalins on github.
  • I am ansismalins (https://keybase.io/ansismalins) on keybase.
  • I have a public key ASDVDxjtxf7HCZupGz3wHx0bl4eWek551qhRD49HIS7Mxwo

To claim this, I am signing this object:

@AnsisMalins
AnsisMalins / JsonBuilder.cs
Last active March 19, 2019 00:20
A Very Ghetto JSON Writer
public struct JsonBuilder
{
private StringBuilder sb;
public int Indentation;
public JsonBuilder(StringBuilder sb)
{
Indentation = 0;
this.sb = sb;
}
@AnsisMalins
AnsisMalins / QueryWindow.cs
Last active November 1, 2019 21:44
LINQ Query Window for Unity
using Microsoft.CSharp;
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using UnityEditor;
@AnsisMalins
AnsisMalins / ArrayPool.cs
Last active May 19, 2019 11:12
Array Pool
public static class ArrayPool<T>
{
private static readonly List<T[]> pool = new List<T[]>();
public static Item Get(int length)
{
for (int i = pool.Count - 1; i >= 0; i--)
{
var array = pool[i];
if (array.Length >= length)
using UnityEditor;
using UnityEngine;
public sealed class AssetBundleLoader : ScriptableWizard
{
public string sourcePath;
[MenuItem("Wizard/Load Asset Bundle")]
private static void CreateWizard()
{
@AnsisMalins
AnsisMalins / DependencyTracker.cs
Last active October 3, 2019 15:48
Adds a context menu item in Unity to find where an asset is used
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using Object = UnityEngine.Object;
public static class DependencyTracker
{
private static Dictionary<string, List<string>> dependantCache;
@AnsisMalins
AnsisMalins / DialogueGraphEditor.cs
Created January 5, 2020 15:49
How to do a custom node graph editor in Unity 2018.4 or 2019.2
// The commented out parts are for Unity 2018.4
//using System.Reflection;
//using UnityEditor.Experimental.UIElements.GraphView;
//using UnityEngine.Experimental.UIElements;
//using UnityEngine.Experimental.UIElements.StyleEnums;
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEditor.Experimental.GraphView;
using UnityEngine;
@AnsisMalins
AnsisMalins / index.html
Last active June 4, 2021 07:04
Unity WebGL template that fills the viewport
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>%UNITY_WEB_NAME%</title>
<style>
body {
margin: 0;
}
@AnsisMalins
AnsisMalins / PathGUI.cs
Created August 6, 2020 09:49
Unity editor inspector fields to browse for paths
using System;
using System.IO;
using UnityEditor;
using UnityEngine;
public static class PathGUI
{
public static void OpenFileField(string label, ref string path)
{
string directory = path;