Skip to content

Instantly share code, notes, and snippets.

@hyakugei
hyakugei / installation_instructions.md
Created August 12, 2021 17:27 — forked from DivineDominion/installation_instructions.md
nvALT Preview Template featuring relative paths

Run this from your terminal to execute the setup script. It creates the directory and downloads the template right into this new folder.

curl -s https://gist.githubusercontent.com/DivineDominion/ab1abe8d2b93d4b73d69/raw/6a7066f1fbcf45e3c47a8d85acee475dd33bd32c/install.sh | bash 

Aferwards, you can change the base directory in ~/Library/Application\ Support/nvALT/template.html as expected.

@hyakugei
hyakugei / MinMaxSliderAttribute.cs
Last active March 18, 2021 03:32 — forked from frarees/MinMaxSliderAttribute.cs
MinMaxSlider for Unity3D
// https://frarees.github.io/default-gist-license
using System;
using UnityEngine;
[AttributeUsage(AttributeTargets.Field, Inherited = true, AllowMultiple = false)]
public class MinMaxSliderAttribute : PropertyAttribute
{
public readonly float min;
public readonly float max;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[RequireComponent(typeof(Rigidbody))]
public class Repulser : MonoBehaviour
{
[SerializeField]
Collider[] colliderList;
[SerializeField]
@hyakugei
hyakugei / AnimatorExtensions.cs
Last active May 12, 2020 16:04 — forked from stonstad/AnimatorExtensions.cs
Unity Animation State Start and Stop Notifications
using System;
using System.Reflection;
using UnityEngine;
public static class AnimatorExtensions
{
/// <summary>Gets an instance method with single argument of type <typeparamref
/// name="TArg0"/> and return type of <typeparamref name="TReturn"/> from <typeparamref
/// name="TThis"/> and compiles it into a fast open delegate.</summary>
/// <typeparam name="TThis">Type of the class owning the instance method.</typeparam>
@hyakugei
hyakugei / UdpConnection.cs
Created January 29, 2020 17:52
async udp class for Unity
// taken from https://forum.unity.com/threads/simple-udp-implementation-send-read-via-mono-c.15900/#post-3645256
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using deVoid.UIFramework;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public abstract class OptionsBase
{
public abstract ushort typeId { get; }
public abstract void Serialize(BinaryWriter writer);
@hyakugei
hyakugei / example.cs
Last active April 28, 2018 18:38
Unity3d IEnumerator, Coroutines and Partial Function Application
// Learning from https://codeblog.jonskeet.uk/2012/01/30/currying-vs-partial-function-application/
public void DoThings()
{
Func<Vector3, PlayerController, IEnumerator> orig = MoveToLocationAction;
var t = ApplyPartial(orig, data.eventObjects[0].point);
var t1 = ApplyPartial(t, player);
var tt = ApplyPartial(orig, data.eventObjects[1].point);
var tt1 = ApplyPartial(t, player);
@hyakugei
hyakugei / RandomColor.cs
Last active November 9, 2015 01:03
Unity3D version of Nathan Jones' C# Port of David Merfield's javascript random color generator.
// C# Port - https://github.com/nathanpjones/randomColorSharped
// Javascript Original - https://github.com/davidmerfield/randomColor
using UnityEngine;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
var body = document.getElementsByTagName("body")[0];
body.innerHTML = 'Hello, World!';
navigator.getMedia = (navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia);
navigator.getMedia(
// constraints
{video:true, audio:false},
// success callback