This file contains hidden or 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
| // Code for this article: | |
| // https://github.com/ciscoheat/mithril-hx/wiki/Typesafe-web-routes-with-Haxe-in-less-than-100-lines | |
| #if macro | |
| import haxe.Serializer; | |
| import haxe.Unserializer; | |
| import haxe.macro.Context; | |
| import haxe.macro.Expr; | |
| import sys.io.File; |
This file contains hidden or 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 UUID { | |
| public static function uuid() { | |
| // Based on https://gist.github.com/LeverOne/1308368 | |
| var uid = new StringBuf(), a = 8; | |
| uid.add(StringTools.hex(Std.int(Date.now().getTime()), 8)); | |
| while((a++) < 36) { | |
| uid.add(a*51 & 52 != 0 | |
| ? StringTools.hex(a^15 != 0 ? 8^Std.int(Math.random() * (a^20 != 0 ? 16 : 4)) : 4) | |
| : "-" | |
| ); |
This file contains hidden or 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
| function r(f){/(un|ing)/.test(document.readyState)?setTimeout(r,9,f):f()} |
This file contains hidden or 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
| <Canvas xmlns="..." xmlns:x="..." ...> | |
| <Canvas.Resources> | |
| <Storyboard | |
| x:Name="mouseEnterAnimation"> | |
| <ColorAnimation | |
| Duration="00:00:0.2" | |
| To="Purple" | |
| Storyboard.TargetProperty= | |
| "(Shape.Fill).(GradientBrush. | |
| GradientStops)[1]. |
This file contains hidden or 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 js.Browser; | |
| import mithril.M; | |
| class App implements Mithril { | |
| public static function main() { | |
| M.mount(Browser.document.body, new App()); | |
| } | |
| var tests = []; |
This file contains hidden or 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
| /* | |
| How to run: | |
| 1. Download and install Haxe: http://haxe.org/download/ | |
| 2. Save this code to Main.hx and open a command prompt in the same directory | |
| 3. Execute "haxelib install haxedci" | |
| 4. Execute "haxe -main Main -lib haxedci --interp" | |
| For javascript output: | |
| haxe -main Main -lib haxedci -js moneytransfer.js | |
| */ |
This file contains hidden or 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 User implements Model { | |
| @prop public var name : String; | |
| public function new(name) { | |
| this.name = M.prop(name); | |
| } | |
| } | |
| class TestModule implements View { | |
| var user:User; | |
This file contains hidden or 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 js.npm.mongoose.macro.Manager; | |
| import js.npm.mongoose.macro.Model; | |
| typedef AttractionSchema = { | |
| name: String, | |
| description: String, | |
| location: { lat: Float, lng: Float }, | |
| history: { |
This file contains hidden or 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
| // The format is JSON, but using js for comments. | |
| { | |
| // Type (Starts with Uppercase to differentiate from the primitive types) | |
| "IncomingForm": { | |
| "" : "Empty key leaves room for a description.", | |
| // A function ends with (). Array value signifies overloading | |
| "parse()": [{ | |
| "" : "Parse a form", | |
| // Parameter: Type | |
| "req": "js.npm.express.Request", |
This file contains hidden or 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
| # -*- mode: ruby -*- | |
| # vi: set ft=ruby : | |
| # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | |
| VAGRANTFILE_API_VERSION = "2" | |
| Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
| # All Vagrant configuration is done here. The most common configuration | |
| # options are documented and commented below. For a complete reference, | |
| # please see the online documentation at vagrantup.com. |