Skip to content

Instantly share code, notes, and snippets.

@djcsdy
djcsdy / debug-swf.sh
Created June 13, 2012 00:25 — forked from Draknek/debug-swf.sh
Launches a SWF in an fdb session so you can see traces and uncaught exceptions
#!/bin/sh
SWF="$1"
( echo continue; cat ) | fdb "$SWF"
package;
import flash.MovieClip;
class Bubble {
// Set this to true when the bubble is 'created'.
// Set it to false when the bubble is popped.
public var active:Bool;
var movieClip:MovieClip;
@djcsdy
djcsdy / gist:3514122
Created August 29, 2012 15:13
Games made for Ludum Dare 24 at CB2
@djcsdy
djcsdy / broken-page.png
Created August 30, 2012 17:22
Bug report images
broken-page.png
@djcsdy
djcsdy / haxedoc.xml
Created September 1, 2012 20:28
Cut-down haxedoc.xml illustrating a bug in haxedoc.
<haxe>
<typedef path="kong.Services" params="" file="./kong/Services.hx"><a>
<showRegistrationBox set="method">
<f a=""><e path="Void"/></f>
<haxe_doc>Displays the user registration UI.
*
* This is useful if the player is a guest but you want to authenticate them for a multiplayer game,
* or to upsell an item.</haxe_doc>
</showRegistrationBox>
<isGuest set="method">
---------------
Dear Foo Communications Support,
I have a minor problem with your otherwise fine service. I worked around it
by doing [X].
It would be nice if you could do [Y] because then the problem will be solved
for all your customers.
class Idiocy {
function doSomethingHatstand(o:Object) {
// do something preposterous
}
function doSomethingLampshade(o:Object) {
// do something asinine
}
public function doSomething(o:Object) {
@djcsdy
djcsdy / Application.java
Created September 17, 2012 19:38
This qualifies as IoC. You don’t need no stinkin’ framework.
// This class acts as both the injector and the list of components.
//
// It contains a bit of boilerplate so although it’s easy to write it’s not great fun.
//
// It does have the advantage of being very straightforward to understand, and
// everything is static and checked at compile-time.
class Injector {
public static void main(String[] args) {
Repository repository = new RepositoryImpl();
PostBox postBox = new PostBoxImpl();
@djcsdy
djcsdy / gist:3812588
Created October 1, 2012 15:44
Bounding box of a moving polygon
https://twitter.com/danielcassidy/status/252792108522545152/photo/1/large
P_A = P at A
P_B = P at B
1. For each edge E in P_A:
2. Compute a quad containing the edge E and, opposite, its corresponding edge in P_B.
3. Compute the union of all quads.
Leaving the exact algorithm for 3 undefined since I have a geometry library that can do
@djcsdy
djcsdy / folders.cpp
Created November 17, 2012 10:10
Useful Windows Known Folders
// If targeting Windows 2000 and later.
LPTSTR pszPath = (LPTSTR) malloc(MAX_PATH);
// If targeting Windows Vista and later, we don't have to allocate our own string.
PWSTR* ppszPath;
// Local Application Data (e.g. C:\Users\djc\AppData\Local
// If targeting Windows 2000 and later
SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, pszPath);
// If targeting Windows Vista and later