Skip to content

Instantly share code, notes, and snippets.


Michael Stevenson mstevenson

View GitHub Profile
mstevenson /
Last active Jul 18, 2022
Shell script to batch convert old QuickTime moves to MP4
#!/usr/bin/env bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
if [ ! -d "$OUTPUT" ]; then
mkdir -p "$OUTPUT";
for i in *.mov;
mstevenson / .gitattributes
Last active Jan 17, 2022
Git configuration files for Unity projects
View .gitattributes
*.cs diff=csharp
# Macro attribute, linguist-generated means the file is ignored for the
# repository's language statistics and diffs are hidden by default
[attr]unity-yaml-file -text -merge=unityamlmerge linguist-generated
# Macro attribute for LFS files
[attr]lfs-file filter=lfs diff=lfs merge=lfs -text
### Unity YAML Files ###
mstevenson / RequiredFieldAttribute.cs
Created Nov 8, 2019
Visually indicate that a Unity inspector value is required.
View RequiredFieldAttribute.cs
using System;
using UnityEngine;
/// <summary>
/// Indicates that an inspector field must have its value assigned during authoring.
/// </summary>
public class RequiredFieldAttribute : PropertyAttribute
mstevenson / PennerEasing.cs
Created Dec 30, 2018
Robert Penner's Easing Functions ported to Unity
View PennerEasing.cs
* PennerEasing
* Calculates a float value between two target values using
* Robert Penner's easing equations for interpolation over a specified duration.
* @author Darren David
* @version 1.0
* Credit/Thanks:
* Robert Penner - The easing equations we all know and love
mstevenson / InklewriterSharpSaveRestore.cs
Created Jan 11, 2018
An idea for how to save and restore the state of an InklewriterSharp game.
View InklewriterSharpSaveRestore.cs
// Load story file
string storyJson = File.ReadAllText ("Stories/musgraveritual.json");
StoryModel model = StoryModel.Create (storyJson);
// Find the saved stitch and fast forward the story's initial stitch:
string restoredStitchName = "holmesResumedHis"; // load this from disk
foreach (var stitch in model.Story.Stitches) {
if (stitch.Name == restoredStitchName) {
// Fast forward the story to this stitch
model.Story.InitialStitch = stitch;
View osxtweaks.txt
# OS X Tweaks
# ===========
# General
# -------
# Disable smart quotes and dashes
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
mstevenson /
Created Jun 12, 2016
Convert Ogg to MP3 with ffmpeg
for name in *.ogg; do ffmpeg -i "$name" -ab 128k -map_metadata 0:s:0 "${name/.ogg/.mp3}"; done;
mstevenson / IEnumeratorExtension.cs
Created Apr 10, 2016
Execute a Unity Coroutine in one frame without yielding
View IEnumeratorExtension.cs
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public static class IEnumeratorExtensions
/// <summary>
/// Execute an entire Unity Coroutine in one frame.
/// This is useful for testing coroutines with NUnit.
mstevenson / DoForSeconds.cs
Created Jan 23, 2016
An alternative to Unity's WaitForSeconds yield instruction that invokes a callback during each Update.
View DoForSeconds.cs
/// <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 / lfs.gitattributes
Last active Dec 30, 2019
Git LFS attributes file for Unity, Maya and ZBrush
View lfs.gitattributes
# unity
*.unitypackage filter=lfs diff=lfs merge=lfs -text
*.cubemap filter=lfs diff=lfs merge=lfs -text
*.spm filter=lfs diff=lfs merge=lfs -text
# models
*.mb filter=lfs diff=lfs merge=lfs -text
*.MB filter=lfs diff=lfs merge=lfs -text