Skip to content

Instantly share code, notes, and snippets.

View jdonaldson's full-sized avatar

Justin Donaldson jdonaldson

  • Mercer Island, Washington
  • 13:59 (UTC -08:00)
View GitHub Profile
@jdonaldson
jdonaldson / gist:630335
Created October 16, 2010 22:15
unject example
import unject.StandardKernel;
import unject.UnjectModule;
import haxe.rtti.Infos;
class Demo{
public static function main()
{
var kernel = new StandardKernel([new TestModule()]);
var samurai = kernel.get(Samurai);
@jdonaldson
jdonaldson / Localization.hx
Created December 20, 2010 21:40
quick and dirty localization example
import haxe.macro.Context;
import haxe.xml.Fast;
import haxe.macro.Expr;
class Localization
{
#if macro
static var id_hash = new Hash<String>();
#end
public static function main(): Void
{
var pre_span_color = #009;
var pre_color = #090;
var swf_1 = {
border : 1px solid #0079b9;
padding : 1px;
}
CSS('*{
@jdonaldson
jdonaldson / index.html
Created September 4, 2011 23:31
taken from block #1191530
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>bar</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script>
<script type="text/javascript" src="jquery.tipsy.js"></script>
<link rel="stylesheet" href="tipsy.css" type="text/css"/>
@jdonaldson
jdonaldson / index.html
Created September 11, 2011 02:50
a tipsy example with changing data
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>index</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="https://raw.github.com/mbostock/d3/master/d3.js" type="text/javascript" charset="utf-8"></script>
<script src="https://raw.github.com/bigmlcom/tipsy/master/src/javascripts/jquery.tipsy.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" href="http://onehackoranother.com/projects/jquery/tipsy/stylesheets/tipsy.css" type="text/css" title="no title" charset="utf-8">
</head>
@jdonaldson
jdonaldson / graph.json
Created September 12, 2011 16:36 — forked from mbostock/.block
Force-Directed Layout (with tipsy labels)
{"nodes":[{"name":"Myriel","group":1},{"name":"Napoleon","group":1},{"name":"Mlle.Baptistine","group":1},{"name":"Mme.Magloire","group":1},{"name":"CountessdeLo","group":1},{"name":"Geborand","group":1},{"name":"Champtercier","group":1},{"name":"Cravatte","group":1},{"name":"Count","group":1},{"name":"OldMan","group":1},{"name":"Labarre","group":2},{"name":"Valjean","group":2},{"name":"Marguerite","group":3},{"name":"Mme.deR","group":2},{"name":"Isabeau","group":2},{"name":"Gervais","group":2},{"name":"Tholomyes","group":3},{"name":"Listolier","group":3},{"name":"Fameuil","group":3},{"name":"Blacheville","group":3},{"name":"Favourite","group":3},{"name":"Dahlia","group":3},{"name":"Zephine","group":3},{"name":"Fantine","group":3},{"name":"Mme.Thenardier","group":4},{"name":"Thenardier","group":4},{"name":"Cosette","group":5},{"name":"Javert","group":4},{"name":"Fauchelevent","group":0},{"name":"Bamatabois","group":2},{"name":"Perpetue","group":3},{"name":"Simplice","group":2},{"name":"Scaufflaire","group":2},
// Copyright (c) 2011, the HaXe project authors.
// All rights reserved.
// Simple test program to compare haXe style js output with dart version:
// https://gist.github.com/1277224
// compile: haxe -main HelloHaxeTest -js test.js
class HelloHaxeTest {
static function main() {
trace("Hello, HaXer!");
}
@jdonaldson
jdonaldson / JsonHxDef.hx
Created December 10, 2011 01:54
jsonhxdef is a ruby script that helps you quickly define a typedef from some arbitary json
typedef JsonObj = {
glossary:Glossary,
}
typedef Glossary = {
title:String,
GlossDiv:GlossDiv,
}
typedef GlossDiv = {
@jdonaldson
jdonaldson / Jsonify.hx
Last active September 28, 2015 18:38
Create compile-time typed objects from arbitrary json strings
#if macro
import haxe.macro.Expr;
import haxe.macro.Context;
import hxjson2.JSON;
import haxe.Http;
import neko.FileSystem;
#end
class Jsonify {
@jdonaldson
jdonaldson / MacroLambda.hx
Created February 24, 2012 00:06
MacroLambda: Automatically return new lists or arrays depending on the map argument type.
import haxe.macro.Expr;
import haxe.macro.Context;
class MacroLambda
{
public static function main(): Void
{
trace('Hello World');