Skip to content

Instantly share code, notes, and snippets.

@LoganBarnett
LoganBarnett / web.config.xml
Created April 1, 2012 21:01
Snippet of web.config needed to make HTTP verbs work in IIS
<system.webserver>
<validation validateintegratedmodeconfiguration="false">
<modules runallmanagedmodulesforallrequests="true">
<remove name="WebDAVModule">
</remove></modules>
</validation></system.webserver>
@LoganBarnett
LoganBarnett / PrototypeDataService.cs
Created April 1, 2012 21:00
Example data service from OData
using System;
using System.Collections.Generic;
using System.Data.Services;
using System.Data.Services.Common;
using System.Linq;
using System.ServiceModel.Web;
using System.Web;
namespace ODataPrototype
{
@LoganBarnett
LoganBarnett / ScatterParts.cs
Created April 1, 2012 20:52
Scatters parts of the Droid from the original model using rigidbodies
private void ScatterParts() {
foreach (Transform child in droidModel.transform) {
// Can't do this here, because it mutates the enumerable!
//child.parent = null;
var meshFilter = child.gameObject.GetComponent<MeshFilter>();
if (meshFilter == null) continue;
var rigidbody = child.gameObject.AddComponent<Rigidbody>();
var collider = child.gameObject.AddComponent<MeshCollider>();
collider.sharedMesh = meshFilter.sharedMesh;
@LoganBarnett
LoganBarnett / StationSpawnGizmo.cs
Created March 9, 2012 15:52
Code for showing spawn points in Droids
using UnityEditor;
using UnityEngine;
using System.Collections;
using System.Linq;
public class StationSpawnGizmo : MonoBehaviour {
[DrawGizmo(GizmoType.NotSelected | GizmoType.Pickable)]
static void RenderLightGizmo(GameObject gameObject, GizmoType gizmoType) {
if (gameObject.CompareTag("StationSpawn") && string.IsNullOrEmpty(AssetDatabase.GetAssetPath(gameObject))) {
@LoganBarnett
LoganBarnett / gitconfig+diffmerge
Created March 5, 2012 18:10
Git config using colors and diffmerge
[color]
ui = true
[mergetool "diffmerge"]
cmd = /Applications/DiffMerge.app/Contents/MacOS/DiffMerge \
--nosplash \
--result="$PWD/$MERGED" \
"$PWD/$REMOTE" \
"$PWD/$BASE" \
"$PWD/$LOCAL"
@LoganBarnett
LoganBarnett / diffmerge
Created March 3, 2012 00:50
Diffmerge config
[mergetool "diffmerge"]
cmd = /Applications/DiffMerge.app/Contents/MacOS/DiffMerge \
--nosplash \
--result="$PWD/$MERGED" \
"$PWD/$REMOTE" \
"$PWD/$BASE" \
"$PWD/$LOCAL"
keepBackup = false
trustExitCode = false
[merge]
import UnityEngine
import System.Collections
class GoblinController(MonoBehaviour):
public player as GameObject
public world as GameObject
public strikingDistance = 1.5f
public damage = 1f
public swingTime = 0.5f
public swingSound as AudioClip
@LoganBarnett
LoganBarnett / ssh-copy-id
Created September 3, 2011 00:26
ssh copy for mac
#!/bin/sh
# Shell script to install your public key on a remote machine
# Takes the remote machine name as an argument.
# Obviously, the remote machine must accept password authentication,
# or one of the other keys in your ssh-agent, for this to work.
ID_FILE="${HOME}/.ssh/id_rsa.pub"
if [ "-i" = "$1" ]; then
@LoganBarnett
LoganBarnett / .gitconfig
Created August 24, 2011 15:48
git w/ diffmerge
[user]
name = Logan Barnett
email = [email protected]
[color]
status = auto
branch = auto
diff = auto
[mergetool "diffmerge"]
cmd = /Applications/DiffMerge.app/Contents/MacOS/DiffMerge \
--nosplash \
@LoganBarnett
LoganBarnett / CallbacksInEvents.cs
Created June 21, 2011 17:09
Demonstrates callbacks inside events using Action<T> or Func<T>
public delegate void CreateThingHandler(Func<Thing, Thing> preCreate, Thing thing);
public class Thing
{
public static event CreateThingHandler OnMadeThing;
public bool Valid { get; set;}
List<Thing> things = new List<thing>();
public static Thing MakeThing(Func<Thing, Thing> func)
{