Skip to content

Instantly share code, notes, and snippets.

View mstevenson's full-sized avatar

Michael Stevenson mstevenson

View GitHub Profile
@mstevenson
mstevenson / maya_sublime.mel
Last active August 29, 2015 14:06 — forked from fredrikaverpil/maya_sublime.py
Send selected code snippets to Maya via commandPort
// Close ports if they were already open under another configuration
if (catch(`commandPort -name ":7001" -close True`)) {
warning "Could not close port 7001 (maybe it is not opened yet...)";
}
if (catch(`commandPort -name ":7002" -close True`)) {
warning "Could not close port 7002 (maybe it is not opened yet...)";
}
// Open new ports
commandPort -name ":7001" -sourceType "mel";
@mstevenson
mstevenson / gist:0e3b03cefe82c7ff2e6e
Created September 27, 2014 22:47
All ffmpeg optional codecs through homebrew
brew install ffmpeg --with-vpx --with-libvpx --with-vorbis --with-libvorbis --with-theora --with-libtheora --with-libogg --with-gpl --with-version3 --with-nonfree --with-postproc --with-libaacplus --with-libass --with-libcelt --with-libfaac --with-libfdk-aac --with-libfreetype --with-libmp3lame --with-libopencore-amrnb --with-libopencore-amrwb --with-libopenjpeg --with-openssl --with-libopus --with-libschroedinger --with-libspeex --with-libvo-aacenc --with-libx264 --with-libxvid
@mstevenson
mstevenson / MonoDevelop 2.4 Scheme.xml
Created December 24, 2011 04:10
MonoDevelop 2.4 Default Highlighting Scheme
<EditorStyle name="MonoDevelop 2.4" _description="Old default MonoDevelop theme">
<Style name="text" color="#000000" bgColor="#FFFFFF" />
<Style name="text.background.readonly" color="#FAFAFA" />
<Style name="linenumber" color="#888A85" bgColor="#FDFDFF" />
<Style name="linenumber.highlight" color="#555753" />
<Style name="iconbar" color="#FDFDFF" />
<Style name="iconbar.separator" color="#BABDB6" />
<Style name="fold" color="#BABDB6" bgColor="#FDFDFF" />
<Style name="fold.highlight" color="#555753" />
<Style name="fold.togglemarker" color="#000000" />
# OS X Tweaks
# ===========
# General
# -------
# Disable smart quotes and dashes
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
@mstevenson
mstevenson / DoForSeconds.cs
Created January 23, 2016 08:56
An alternative to Unity's WaitForSeconds yield instruction that invokes a callback during each Update.
/// <summary>
/// Yield on a DoForSeconds object within a coroutine and the supplied callback method
/// will be invoked during each Unity Update cycle.
///
/// Example: yield return DoForSeconds (1, (elapsed, duration) => { Debug.Log (elapsed/duration); });
/// </summary>
public class DoForSeconds : CustomYieldInstruction
{
public delegate void UpdateCallback (float elapsed, float duration);
@mstevenson
mstevenson / Instruments.cs
Created February 4, 2015 10:15
Unity tool for measuring execution time
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
/// <summary>
/// Debugging tools
/// </summary>
public static class Instruments
{
static string stopwatchName;
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
public class CreateMergedMesh : ScriptableWizard
{
[MenuItem ("Prototype/Create Merged Mesh")]
static void CreateDataMesh ()
{
using UnityEngine;
using System.Collections;
public class ObliqueCameraProjection : MonoBehaviour
{
private Matrix4x4 originalProjection;
public Vector2 slideViewport;
public Vector2 slideFrustum;
public Vector2 slideFarClip; // compound slideViewport and slideFrustum
public Vector2 skew;
@mstevenson
mstevenson / gist:10706756
Created April 15, 2014 06:20
GetComponentsInChildrenRecursive
void GetComponentsInChildrenRecursive<T> (Transform parent, List<T> buffer)
where T : Component
{
foreach (Transform t in parent) {
var c = t.GetComponent<T> ();
if (c) {
buffer.Add (c);
}
GetComponentsInChildrenRecursive (t, buffer);
}
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the