Skip to content

Instantly share code, notes, and snippets.

@elsassph
elsassph / titanium-build.json
Created January 5, 2012 13:38
Sublime Text 2 build file for Titanium
{
"cmd": "/usr/local/bin/titanium.sh run --platform=iphone",
"shell": true,
"selector": "source.js",
"working_dir": "${project_path:${folder}}"
}
@elsassph
elsassph / 0-Example.hx
Last active May 25, 2016 20:04
Haxe - use macro to generate dispatch code
/*
Automatically generate dispatch functions as:
public function onDoubleArguments(one:String, two:Int) {
for (listener in listeners)
listener.onDoubleArguments(one, two);
}
*/
class Example extends Dispatcher<Dynamic>
{
@elsassph
elsassph / Module1.hx
Last active December 29, 2015 14:08
One approach to building Haxe JS modules - EDIT: see https://github.com/elsassph/modular-haxe-example
package modules;
class Module1
{
static public function main()
{
trace("Module1 is loaded");
var m1 = new Module1();
}
@elsassph
elsassph / SkyboxLite.as
Created September 6, 2012 18:21
Sample Away3D Lite Stage3DRenderer
package
{
import away3dlite.containers.View3D;
import away3dlite.core.render.Renderer;
import away3dlite.core.render.Stage3DRenderer;
import away3dlite.events.MouseEvent3D;
import away3dlite.materials.BitmapMaterial;
import away3dlite.primitives.Plane;
import away3dlite.primitives.Skybox6;
import flash.display.Shape;
@elsassph
elsassph / cmdbash-here.reg
Created March 13, 2012 08:59
Command and Bash prompt here
REGEDIT4
[HKEY_CLASSES_ROOT\Directory\shell\BashHere]
@="Open &Bash prompt here"
[HKEY_CLASSES_ROOT\Directory\shell\BashHere\command]
@="c:\\cygwin\\bin\\bash.exe --login -c \"cd '%1' ; exec /bin/bash -rcfile ~/.bashrc\""
[HKEY_CLASSES_ROOT\Drive\shell\BashHere]
@="Open &Bash prompt here"
@elsassph
elsassph / README.MD
Created February 26, 2012 17:32
Patch for Titanium VideoPlayer requestThumbnailImagesAtTimes

VideoPlayer.requestThumbnailImagesAtTimes(times, flag, callback) is all broken:

  • the callback is required although indicated to be optional in the doc
  • this callback is called once, effectively returning only the first thumbnail.

This feature was re-implementated so that it returns all the thumbnails in one event. All the times/thumbnails are added to the event object as indexed properties:

function thumbnailsCallback(e) { var i = 0; while(e["thumbnail" + i]) {

@elsassph
elsassph / sublimelinter-settings.json
Created January 5, 2012 13:22
My SublimeLinter's settings
[...]
/*
The minimum delay in seconds (fractional seconds are okay) before
a linter is run when the "sublimelinter" setting is true. This allows
you to have background linting active, but defer the actual linting
until you are idle. When this value is greater than the built in linting delay,
errors are erased when the file is modified, since the assumption is
you don't want to see errors while you type.
*/
@elsassph
elsassph / 10squares.hx.js
Created December 30, 2011 09:49 — forked from xitij2000/10squares.hx.js
haXe code to print squares of first 10 numbers.
Main.main = function() {
js.Lib.document.write(Main.square(10).join(","));
}
Main.square = function(n) {
var result = [];
var _g = 0;
while(_g < n) {
var i = _g++;
result.push(i * i);
}