Skip to content

Instantly share code, notes, and snippets.

View MattRix's full-sized avatar

Matt Rix MattRix

View GitHub Profile
@MattRix
MattRix / Socket.io with Node.js error
Created May 11, 2011 20:40
Error with Socket.io and Node.js
Initializing client with transport "websocket"
node: ../src/node.cc:1210: ssize_t node::DecodeWrite(char*, size_t, v8::Handle<v8::Value>, node::encoding): Assertion `b[1] == 0' failed.
@MattRix
MattRix / FSpriteOverlap
Created August 16, 2012 02:27
Checking FSprites for overlap with a point
someSprites //your list of sprites you want to check through
Vector2 checkPoint = new Vector2(155,100); //the point you want to check
List<FSprite> overlapSprites = new List<FSprite>(); //a list of sprites that contain the point
foreach(FSprite sprite in someSprites)
{
//"this" should be whatever node you're currently in, or Futile.stage
Vector2 localPoint = sprite.LocalToLocal(this, checkPoint);
@MattRix
MattRix / BitmapHierarchyTester.as
Created August 22, 2012 21:29
A way of using the display tree while still only drawing bitmaps in AS3
package ca.struct
{
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Sprite;
import flash.events.Event;
[SWF (width=500,height=400,backgroundColor=0x000000,frameRate=60)]
public class BitmapHierarchyTester extends Sprite
{
@MattRix
MattRix / CSharpPerformanceTester
Created August 24, 2012 15:18
A tool for comparing the performance of different code in C#. Just call PerfTest.Run();
using System;
using System.Collections.Generic;
using System.Diagnostics;
public class Thing
{
public float a;
public float b;
public float c;
@MattRix
MattRix / TrainyardPuzzleExample.xml
Created September 17, 2012 15:57
Really old Trainyard puzzle example
<grid rows="7" cols="7">
<pieces>
<destination pos="0,0" sides="r" colors="p"/>
<splitter pos="3,0" side="b"/>
<station pos="6,0" side="l" colors="o"/>
<factory pos="0,3" sides="tb" color="r"/>
<rock pos="1,3"/>
<rock pos="2,3"/>
<rock pos="3,3"/>
<rock pos="4,3"/>
@MattRix
MattRix / FNodeLink
Last active December 10, 2015 12:48
This class allows you to link the position of a Unity GameObject to a Futile FNode. You should set METERS_TO_POINTS to a value that makes sense for your current game.
@MattRix
MattRix / ScopeDifferences.cs
Created January 8, 2013 06:37
Scope differences: C vs C# vs AS3 (using C/C# code, but it applies equally to AS3)
///// Example 1 - C:Valid, C#:Error, AS3:Warning /////
bool isHappy = true;
if(true)
{
bool isHappy = true;
}
///// Example 2 - C:Valid, C#:Error, AS3:Warning /////
@MattRix
MattRix / RXDebug.cs
Created May 19, 2013 04:07
RXDebug tracks instance counts
using System;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Timers;
@MattRix
MattRix / RXExtensions.cs
Last active December 17, 2015 17:29
Extension methods for logging arrays and lists in C#, just call someArray.Log() or someList.Log(), or if you want a name logged with it, then just someArray.Log("The list of things")
using System;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
//USAGE:
//someArray.Log();
//someArray.Log("a name");
//someList.Log();
//someList.Log("a name");
using System;
using System.Collections.Generic;
public class AudioClipType
{
static public List<AudioClipType> allAudioClipTypes = new List<AudioClipType>();
static public AudioClipType SnakeEat = new AudioClipType("snake_eat","wav",1.0f);
static public AudioClipType UIPress = new AudioClipType("ui_press","wav",1.0f);
static public AudioClipType Explosion = new AudioClipType("explosion","wav",1.0f);