Skip to content

Instantly share code, notes, and snippets.

using UnityEngine;
using System.Collections;
using System;
namespace Prime31
{
public static class ActionExtensions
{
/// <summary>
@prime31
prime31 / provider.js
Created September 30, 2015 22:14
Atom.io Haxe package autocomplete modifications. Just replace the provider.js file from the package with this file. All modifications have the comment MIKEWASHERE for easy identification
// node built in
var path = require('path')
, crypto = require('crypto')
// lib code
, query = require('./query')
, debug = require('./debug')
, file = require('./file')
, state = require('../haxe-state')
, signatures = require('../parsing/signatures')
@prime31
prime31 / curry-potjiekos.recipe
Created August 28, 2015 18:44
MEAT Curry Potjiekos recipe
INSERT-MEAT-TYPE-HERE Curry Potjiekos
Ingredients
2 lb INSERT-MEAT-TYPE-HERE
2 T oil
1 onions, chopped
3 - 6 cloves garlic, crushed
2 - 3 inches ginger, crushed
@prime31
prime31 / ExampleUsage.cs
Last active October 24, 2022 09:51 — forked from MattRix/ObjectInspector.cs
Generic inspector class that lets you implement OnScene/InspectorGUI in your class file instead of in a separate custom editor. It also provides attributes for getting Vector3/Vector3[]/List<Vector3> editing capabilities right in the scene view and getting buttons for any methods in your class in the inspector.
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
public class ExampleUsage : MonoBehaviour
{
// this attribute will add handles for your Vector3s so that you can drag them around in the scene view
@prime31
prime31 / StripGeneratedSolutionSettings
Created May 2, 2015 19:02
Stick this in an Editor folder in your project. Every time the solution file is recreated by Unity it will remove all the cruft that Unity injects into the file. Hopefully, one day, Unity will actually fix this on their end.
/*
v2: Matt Rix pointed out there's an undocumented ONGeneratedCSProjectFiles() callback
https://gist.github.com/MattRix/0bf8de88e16e8b494dbb
v1: Still available in the gist history if you want a FileSystemWatcher solution!
THE PROBLEM:
- Unity constantly rewrites its .sln files whenever you rename/add/remove scripts
@prime31
prime31 / FixGeneratedSolutionSettings
Created April 29, 2015 22:35
Prep for a csproj/sln file fixer for Visual Studio Code. Needs to write out the csproj/sln files in a manner that works. For reference, Xamarin created solutions/projects work fine.
using UnityEngine;
using UnityEditor;
using System.IO;
public class FixGeneratedSolutionSettings : AssetPostprocessor
{
// Undocumented callback, courtesy of Matt Rix astute decompilation of Unity DLLs.
private static void OnGeneratedCSProjectFiles()
{
@prime31
prime31 / ZestyTweenExample.cs
Last active August 29, 2015 14:19
Example showing how the core of ZestKit can be used completely outside of the tween library. It can be used to animate anything any way you want in just a few lines of code. The core Zest methods are all available external to the library.
IEnumerator doMoveTween( Vector3 from, Vector3 to, float duration, EaseType easeType )
{
var elapsedTime = 0f;
while( elapsedTime < duration )
{
// either an ease function or an animation curve can be used here
transform.position = Zest.ease( easeType, from, to, elapsedTime, duration );
elapsedTime += Time.deltaTime;
yield return null;
@prime31
prime31 / WhitsMenuItem.cs
Created February 6, 2015 06:06
MenuItem example
public class WhitsMenuItem : MonoBehaviour
{
[UnityEditor.MenuItem( "Whits Menu/Create ScriptableObject...", false, 10 )]
static void blahBlah()
{
// right here create your ScriptableObject
}
}
@prime31
prime31 / gist:2ee96f1473f425302ab7
Created January 29, 2015 19:01
Unity 5 changes the pause parameter from bool to int so the UnityPause declaration must be changed to account for this. The below declaration covers both Unity 4 and 5.
#if UNITY_VERSION < 500
void UnityPause( bool pause );
#else
void UnityPause( int pause );
#endif
@prime31
prime31 / USPS sucks the big one.markdown
Last active August 29, 2015 14:13
Avoid USPS at all costs. They will do anything and everything to not pay an insurance claim even when their own records show that they did not deliver the package.

Me: sent package with insurance and delivery confirmation to zipcode AAAAAA

USPS: delivered package to zipcode BBBBBB to a different person than was on the shipping label

Me: filed a claim with USPS in an attempt to get the package retrieved and sent to the person it was addressed to

USPS: closed the claim saying the package was "delivered"

Me: appealed the claim detailing that the package was indeed delivered but TO THE WRONG ADDRESS