This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function test() | |
| { | |
| var myBigObject = {}; | |
| setTimeout( function() | |
| { | |
| console.log('' + myBigObject); | |
| }, 1000); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| Simple, colorful logging! | |
| Setup | |
| ===== | |
| Somewhere really early in your code do a: | |
| Log.init(); | |
| This will setup the logger methods and coloring stuff. | |
| Logging |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Since you can't do: | |
| // class MyMap<String, String> extends Map<String, String> | |
| // Try... | |
| import haxe.ds.ObjectMap; | |
| class ObjectMyMap extends ObjectMap<String, String> | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import haxe.ds.ObjectMap; | |
| /* | |
| Simple prioritized queue. Throw objects at it and you'll always get back things according | |
| to a priority you set. Priorities are retained internally, so you don't need to modify your | |
| objects. | |
| Usage: | |
| // create a queue: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @:publicFields class Struct | |
| { | |
| public function new() {} | |
| } | |
| class MyStruct extends Struct | |
| { | |
| var field1:String; | |
| var field2:String; | |
| var field3:Bool; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public function compareTypes(a:Dynamic, b:Dynamic) | |
| { | |
| return (Type.getClass(a) != null) ? (Type.getClass(a) == Type.getClass(b)) : (Type.typeof(a) == Type.typeof(b)); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| find . -name "*.png" -mtime -1 | du | awk '{total+=$1} END{print total}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public function dumpSpriteStack(sprite:Sprite) | |
| { | |
| trace(spriteToString(sprite)); | |
| var parent:Sprite = cast sprite.parent; | |
| var c = 1; | |
| while (parent != null) | |
| { | |
| var indent = '.'; | |
| for (i in 0...c) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Main extends Sprite | |
| { | |
| private var doneFrame:Bool; | |
| public function new() | |
| { | |
| super(); | |
| doneFrame = false; | |
| graphics.beginFill(0xff5555); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var bitmapData = Assets.getBitmapData(bitmapPath); | |
| _fullWidth = bitmapData.width; | |
| _fullHeight = bitmapData.height; | |
| _chunkSize = chunkSize; | |
| _lastChunkRect = new Rectangle(); | |
| _currentChunkRect = new Rectangle(); | |
| // it's different! remove the old cached chunk data | |
| FileUtils.rmdir(_cachePath); |