Skip to content

Instantly share code, notes, and snippets.

@ruby0x1
ruby0x1 / multi-player-html5-games-00-express.js
Created March 27, 2012 15:01
Multi-player games in HTML5
/* Copyright (c) 2012 Sven "FuzzYspo0N" Bergström
http://underscorediscovery.com
MIT Licensed. See LICENSE for full license.
Usage : node simplest.app.js
*/
var
@ruby0x1
ruby0x1 / scriptCore.h
Created March 30, 2012 15:52
An example of the new script binding in Laboratory2D (header)
/*
Copyright (C) 2011 by Underscore Discovery, Sven "FuzzYspo0N" Bergstrom ( http://underscorediscovery.com )
For more license information, please read the following
http://laboratory2D.com/#/license
The license is MIT based, the MIT license is appended to the file.
*/
@ruby0x1
ruby0x1 / scriptCore.cpp
Created March 30, 2012 15:52
An example of the new script binding in Laboratory2D (source)
/*
Copyright (C) 2011 by Underscore Discovery, Sven "FuzzYspo0N" Bergstrom ( http://underscorediscovery.com )
For more license information, please read the following
http://laboratory2D.com/#/license
The license is MIT based, the MIT license is appended to the file.
*/
@ruby0x1
ruby0x1 / TexturePackerJSON.hx
Created November 19, 2012 18:31
JSON TexturePacker importer for Haxenme haxelib SpriteSheet, with behavior and examples
package com.underscorediscovery;
import com.eclecticdesignstudio.spritesheet.data.SpriteSheetFrame;
import com.eclecticdesignstudio.spritesheet.SpriteSheet;
import com.eclecticdesignstudio.spritesheet.data.BehaviorData;
import hxjson2.JSON;
class TexturePackerJSON {
@ruby0x1
ruby0x1 / SpiderMonkeyHelpers.cpp
Last active December 23, 2015 07:09
My SpiderMonkey helper code from my engine. This is under MIT license.
//General crap from startup and shutdown
void startup(void) {
//Create the objects we need to execute js in spidermonkey
spiderRuntime = JS_NewRuntime(0x100000);
spiderContext = JS_NewContext(spiderRuntime, 0x1000);
@ruby0x1
ruby0x1 / cocoafiledialogs.mm
Created September 27, 2013 09:17
rushed/quick Cocoa File dialogs. import cocoa.h.
std::string FileDialogOpen( const std::string &title, const std::string &text, const std::vector<std::string> &fileTypes ) {
// NSArray *fileTypes = [NSArray arrayWithObjects:@"jpg",@"jpeg",nil];
NSOpenPanel * panel = [NSOpenPanel openPanel];
[panel setAllowsMultipleSelection:NO];
[panel setCanChooseDirectories:NO];
[panel setCanChooseFiles:YES];
[panel setFloatingPanel:YES];
@ruby0x1
ruby0x1 / SimpleExample.hx
Last active January 1, 2016 02:29
golems test
import net.rezmason.utils.workers.BasicWorker;
import net.rezmason.utils.workers.BasicBoss;
class SimpleExample {
public static function main() {
var start = haxe.Timer.stamp();
var do_loop = true;
@ruby0x1
ruby0x1 / ghost_excerpt_till_hrule.js
Created January 13, 2014 14:40
Ghost blogging platform helper for excerpt until the first --- in the post.
coreHelpers.excerpt_till_hrule = function (options) {
console.log(options);
var truncateOptions = (options || {}).hash || {},
excerpt;
truncateOptions = _.pick(truncateOptions, ['words', 'characters']);
_.keys(truncateOptions).map(function (key) {
truncateOptions[key] = parseInt(truncateOptions[key], 10);
@ruby0x1
ruby0x1 / bmfont random.hx
Created January 27, 2014 00:28
random code from bmfont loader for haxe
public var dimensions : Vector;
public var spacing : Float = 0.0;
public var line_height : Float = 0.0;
public var font_size : Float = 0.0;
public var font_character_count : Int = 0;
public var pages : Map<Int, Texture>;
public var characters : Map<Int, Character>;
public var kernings : Map< KerningKey, Int >;
@ruby0x1
ruby0x1 / Test.hx
Created March 11, 2014 02:22
Haxe 3.1 string VC++ compiler error
//Adapted from http://haxe.org/doc/start/cpp
class Test {
static function main() {
//The following trace should reproduce the error regardless of haxe version 3+
// trace("
// Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World!
// Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World!