Skip to content

Instantly share code, notes, and snippets.

@noonat
noonat / gist:1649543
Created January 20, 2012 21:02
Rake Quick Reference
# Rake Quick Reference
# by Greg Houston
# http://ghouston.blogspot.com/2008/07/rake-quick-reference.html
# -----------------------------------------------------------------------------
# Running Rake
# -----------------------------------------------------------------------------
# running rake from the command-line:
# rake --help
$ mongo
MongoDB shell version: 2.0.0
connecting to: test
> quit
function () {
return nativeHelper.apply(quit_, arguments);
}
> quit.toString = function() { return 'Type quit() to quit.'; }
function () {
return "Type quit() to quit.";
@noonat
noonat / Main.hx
Created August 10, 2011 21:54
Apple property list parser in HaXe
/**
* Apple property list parser.
*
* For example, the following property list XML:
*
* <?xml version="1.0" encoding="UTF-8"?>
* <plist version="1.0">
* <dict>
* <key>foo</key>
* <integer>1</key>
@noonat
noonat / cube.mtl
Created August 8, 2011 02:10
Cube OBJ and MTL file
newmtl cube
Ns 10.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 0.0000 0.0000 0.0000
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
@noonat
noonat / extract_pak.c
Created August 5, 2011 14:13
Extract files from a Quake PAK
// Extract a PAK file (from Quake 1 and 2)
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
typedef struct {
char id[4];
@noonat
noonat / Game.as
Created June 15, 2011 00:27
AIR 2.7 Android Example Makefile
package {
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.utils.getTimer;
public class Game extends Sprite {
private var _ballX:Number;
private var _ballY:Number;
@noonat
noonat / Main.as
Created June 11, 2011 18:25
Tile connectivity example
package {
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageQuality;
import flash.display.StageScaleMode;
import flash.geom.Point;
import flash.geom.Rectangle;
import flash.events.Event;
<type name="Test_TEST_BITMAP" base="Class" isDynamic="true" isFinal="true" isStatic="true">
<extendsClass type="Class"/>
<extendsClass type="Object"/>
<accessor name="prototype" access="readonly" type="*" declaredBy="Class"/>
<factory type="Test_TEST_BITMAP">
<extendsClass type="mx.core::BitmapAsset"/>
<extendsClass type="mx.core::FlexBitmap"/>
<extendsClass type="flash.display::Bitmap"/>
<extendsClass type="flash.display::DisplayObject"/>
@noonat
noonat / nape_ray.patch
Created March 9, 2011 02:02
Patch to add Ray.group and Ray.sensor to allow rayCast filtering.
diff --git a/nape/cx-src/nape/dynamics/Collide.cx b/nape/cx-src/nape/dynamics/Collide.cx
index a9159c6..713de8c 100644
--- a/nape/cx-src/nape/dynamics/Collide.cx
+++ b/nape/cx-src/nape/dynamics/Collide.cx
@@ -395,22 +395,28 @@ class RayCast {
static public inline var FAIL:Float = 10.0; //>1 for easy comparisons
static public inline function rayCircle(r:Ray,c:Circle) {
- vec_new(ac); vec_sub(r.a,c.centre.p,ac);
- var A = vec_lsq(r.v);
@noonat
noonat / Test.as
Created March 7, 2011 03:40
Nape addCbPreBegin bug
package {
import flash.Boot;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageQuality;
import flash.display.StageScaleMode;
import flash.events.Event;
import nape.callbacks.Callback;
import nape.callbacks.CbType;
import nape.dynamics.Arbiter;