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
(def jquery (js* "$")) | |
(defn show [msg] | |
(let [data-as-json ((js* "JSON.stringify") msg nil 4)] | |
((js* "alert") data-as-json))) | |
(defn make-js-map | |
"makes a javascript map from a clojure one" | |
[cljmap] | |
(let [out (js-obj)] |
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
<?xml version="1.0" encoding="utf-8"?> | |
<project> | |
<!-- <meta /> | |
Use meta nodes to set metadata for your application. The description is ignored | |
on most targets, but is useful for packaging like Chrome Apps or Opera Widgets. | |
For compatibility with Android and webOS, the package name must include at least |
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 haxe.rtti.Meta; | |
@:tag('foo') typedef Foo = { | |
?bar:String, | |
?baz:Int | |
} | |
@:tag typedef Bar = Dynamic; |
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 Main { | |
static function main() { | |
trace(process(12)); // 24 | |
trace(process("Hello world")); // HELLO WORLD | |
} | |
@:generic static function process<T>(t:T):T { | |
return throw "unknown type: " + t; | |
} | |
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
extern class Globals | |
{ | |
public static var context(get, never):Context; | |
inline static function get_context():Context return untyped __js__("context"); | |
} | |
extern class Context | |
{ | |
public function doStuff():Void; | |
} |
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
/** | |
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 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
#if macro | |
import haxe.macro.Context; | |
import haxe.macro.Expr; | |
class SchemaTypeBuilder | |
{ | |
public static function build(ref:String):haxe.macro.Type | |
{ | |
var schema = haxe.Json.parse(sys.io.File.getContent(ref)); | |
var type:ComplexType = parseType(schema); |
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
import haxe.macro.Expr; | |
class FTW | |
{ | |
public static function build() | |
{ | |
return haxe.macro.Context.getBuildFields().map(transformField); | |
} | |
static function transformField(field:Field) |
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
$ mkdir haxe-droid && cd haxe-droid | |
$ git clone https://github.com/vouillon/ocaml-android.git | |
$ git clone https://github.com/HaxeFoundation/haxe.git | |
$ http://dl.google.com/android/ndk/android-ndk-r9b-darwin-x86.tar.bz2 | |
$ tar -vjxf android-ndk-r9b-darwin-x86.tar.bz2 && rm android-ndk-r9b-darwin-x86.tar.bz2 && mv android-ndk-r9b android-ndk | |
$ wget http://caml.inria.fr/pub/distrib/ocaml-4.01/ocaml-4.01.0.tar.gz | |
$ tar -xzf ocaml-4.01.0.tar.gz && rm ocaml-4.01.0.tar.gz && mv ocaml-4.01.0 ocaml-src |
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
/* | |
Copyright (c) 2014 Cauê Waneck | |
All rights reserved. | |
Redistribution and use in source and binary forms are permitted | |
provided that the above copyright notice and this paragraph are | |
duplicated in all such forms and that any documentation, | |
advertising materials, and other materials related to such | |
distribution and use acknowledge that the software was developed | |
by the <organization>. The name of the |
OlderNewer