This file contains 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 map = ds_map_create(); | |
var keys = ds_list_create(); | |
var values = ds_list_create(); | |
var num = 10000; | |
var t, k, v; | |
for (var i = 0; i < num; i++) { | |
k = i * 2 + 1; | |
v = irandom(10); | |
ds_list_add(keys, k); | |
ds_list_add(values, v); |
This file contains 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
repeat (10000) { | |
instance_create(0, 0, obj_some); // (blank) | |
} | |
var t, r, this; | |
r = ds_list_create(); | |
this = 1000; | |
// | |
t = current_time; | |
with (all) if (id != this) ds_list_add(r, id); | |
show_debug_message(string(current_time - t) + "ms"); // 4ms |
This file contains 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
<?php | |
$language_data = array ( | |
'LANG_NAME' => 'Haxe', | |
'COMMENT_SINGLE' => array(1 => '//'), | |
'COMMENT_MULTI' => array('/*' => '*/'), | |
'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, | |
'QUOTEMARKS' => array("'", '"'), | |
'ESCAPE_CHAR' => '\\', | |
'KEYWORDS' => array( | |
1 => array( |
This file contains 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
package; | |
import Pico.*; | |
class Test { | |
static inline function main() { | |
var co = new Collection<Entity>(); | |
co.add(new Man("John")); | |
co.add(new Dog("Dogmeat")); | |
for (entity in co) entity.talk(); | |
} | |
} |
This file contains 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
static function trifill(x1:Fixed, y1:Fixed, x2:Fixed, y2:Fixed, x3:Fixed, y3:Fixed) { | |
var dx12 = x1 - x2; | |
var dx23 = x2 - x3; | |
var dx31 = x3 - x1; | |
// | |
var dy12 = y1 - y2; | |
var dy23 = y2 - y3; | |
var dy31 = y3 - y1; | |
// | |
var minx = min(x1, min(x2, x3)); |
This file contains 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
using System; | |
using System.Collections.Generic; | |
using PluginLoader; | |
using Terraria; | |
/// Updated July 24, 2015 | |
/// Updates: https://gist.github.com/YellowAfterlife/1edaa4060191823ee366 | |
namespace YellowAfterlifePlugins { | |
/// Item modification rules are defined as following: | |
/// [item3507] |
This file contains 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
//{ keyboard_key | |
#define keyboard_key_get_code | |
/// keyboard_key_get_code(name:string):int | |
var r = keyboard_key_codes[?string_lower(argument[0])]; | |
if (!is_undefined(r)) return r; | |
return -1; | |
#define keyboard_key_get_name | |
/// keyboard_key_get_name(code:int):string | |
var code = argument[0]; | |
var r = keyboard_key_names[?code]; |
This file contains 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
package terra; | |
import openfl.Lib; | |
import openfl.utils.ByteArray; | |
import openfl.utils.Endian; | |
import Ext.cfor; | |
using utils.ByteArrayTools; | |
/** | |
* ... |
This file contains 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 Ext { | |
/// C-style for-loop. Uses @pleclech's idea but on macros level. | |
public static macro function cf(init, cond, post, expr) { | |
#if !display | |
var func = null; | |
func = function(expr:haxe.macro.Expr) { | |
return switch (expr) { | |
case macro continue: macro { $post; $expr; } | |
default: haxe.macro.ExprTools.map(expr, func); | |
} |