Git Product home page Git Product logo

try-haxe's Introduction

try-haxe

Build Status

The try-haxe project is a browser-based IDE for testing Haxe code. It provides a quick and easy environment for playing with the Haxe language and compiles to JavaScript or Flash, instantly viewable in the browser. It also allows saving and sharing of programs with the auto-generated hyperlink hash-codes.

The official project is hosted at try.haxe.org.

Technical notes:

The try-haxe project is written in Haxe, with part of the application compiling to JavaScript for use on the client, and part of the application compiling to PHP as a backend service. The backend PHP service provides server-side compilation of programs as well as language auto-complete results.

Run your own instance:

You can run the try-haxe project on a server with Apache, PHP, and Haxe installed. Some commands may be distribution-specific (location of web server root, etc) -- the below works on Ubuntu.

Clone the repo and initialize the submodules:

git clone https://github.com/clemos/try-haxe.git
cd try-haxe
git submodule init
git submodule update

You may need to update the location of the haxe compiler executable in the Compiler.hx source file, line 26. You can specify a full path to your haxe compiler, such as:

public static var haxePath = "/opt/haxe-3.1.3/haxe";

Build the try-haxe compiler and app:

haxe build.hxml

Link (or copy) this project directory to a location served by Apache (or other PHP-enabled web server):

sudo ln -s `pwd` /var/www/

The above creates a /var/www/try-haxe symlinked to your git repo.

Create the tmp directory (where web-based projects will be created and saved):

mkdir tmp
chmod a+rw tmp

Ensure Apache has mod_rewrite enabled:

sudo a2enmod rewrite

Edit the apache configuration file and add the /var/www/try-haxe location with AllowOverrides All directive (so it can use the .htaccess file):

sudo emacs /etc/apache2/sites-available/default

Add a <Directory> entry like so:

# Required by try-haxe
<Directory /var/www/try-haxe>
  Options FollowSymLinks
  AllowOverride All
</Directory>

Restart the apache server:

sudo /etc/init.d/apache2 restart

Navigate to your server (by name, ip address, or localhost) and enjoy try-haxe! http://localhost/try-haxe/

try-haxe's People

Contributors

as3boyan avatar azrafe7 avatar clemos avatar dr-emann avatar gama11 avatar markknol avatar mrcdk avatar nicom1 avatar pleclech avatar profelis avatar tariqbenezza avatar tkawachi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

try-haxe's Issues

haxelib support error

haxelibs must have optional args.

For example jeash works correct only with --remap flash:jeash

And jeash lib require div in result html

Integrate latest haxe build

This is a followup of this issue HaxeFoundation/haxe#3745 (comment)

Question was to add the haxe nightlys somehow on try-haxe to test snippets agains latest compiler version for comparision purposes to see if stuff breaks/is fixed.

Simn pointed me a related interesting thing that could have some more thoughts. You ask for a dev build option so we can compare manually.
But basically it would be great to automatically test the try-haxe snippets that actually compile/run. If we can log that with the current haxe version, we could compile/run the same snippets agains the latest dev build and compare the results. This would give us thousands of free tests.
In my opinion this shouldnt be a public part of try-haxe since this is only interesting for the haxe team. I also think retesting case by case with latest devbuild is not that practical(?) but at the other hand it would be nasty to make everything complete public (who knows what people put in the snippets). So as a separate 'secret' tool/service on top of try-haxe it could be very useful.

What do you think?

Compiler version

I noticed the try.haxe site uses an different version then the current available version on the haxe.org website (3.0.1). Why is different?

What is the compiler version of try.haxe? I see 3.1.0 1c25e98 in the footer, but I'm not sure if this is the try.haxe version or the compiler version.

Haxe 3.2 final

Can we push the try haxe compiler along with the new 3.2 release? (released today)

Setup problems

Was trying to run this locally via haxeserver - seems to be working alright except it doesn't compile. Do I need to do any additional setup first?

Console output.

Allow any class name as host for main()

Currently try.haxe requires the source to have its main method in a class named Test. Would it be possible to lift that restriction and allow arbitrary class names for this?

Loading source from URL

I would like to add try.haxe links into the manual so people can click on them and see that they actually compile. In order to avoid code duplication it would be necessary to load these examples from an URL.

Do you think that would be viable? For security/sanity it might make sense to maintain a white-list of allowed hosts. Our code examples are available at https://github.com/HaxeFoundation/HaxeManual/tree/master/assets.

Unfortunately my own convention is to use Main instead of Test for the main class, so I would have to update them first. I still think that would be worth it.

Enable -D analyzer by default

Since try.haxe.org is updated to 3.2, it makes sense to enable new -D analyzer feature for better JS output. We could also add option to disable it on the "Options" tab.

Support GitHub Gist

It would we awesome if you could create a TryHaxe example that uses a GitHub Gist for it's Source code. That was the author could update examples with some level of version control and dev could also clone the example.

Naturally this might require multiple file support in TryHaxe.

Possible git usage

I was wondering how large the try-haxe folder is getting, with auto-branching. If space becomes a problem, I thought of a solution using git as as a repository to store all of the saved examples, and checking them out to a set number of folders.

Pros

  • Provides a SHA-1 hash which could be used to identify the example (the first 6 digits should be plenty to remain unique)
  • Compression based on the difference to the parent example
  • Reduce redundancy

Cons

  • Requires the server to have git
  • More complex than current strategy
  • Might be pre-mature optimization, if space is not an issue, pointless

If you think this would be a worthwhile idea, I can start work on forking and working on an implementation, but I'd rather not start work on something that's not worthwhile/won't ever be used.

Haxe 3.2

Can we push the try haxe compiler along with the new 3.2 release? (Planned tomorrow)

More haxelib libs.

What are the possibilities for having say, 'all' haxelib libs available for use?

hnlike button is broken

The button next to the like button seems to be broken, and while inspecting it, this is what is printed in the body of the iframe.

Warning: file_get_contents(http://api.thriftdb.com/api.hnsearch.com/items/_search?q="http://try.haxe.org"&weights[url]=50.1&weights[title]=0.0&weights[text]=0.0&weights[domain]=0.0&weights[username]=0.0&weights[type]=0.0) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/content/c/a/l/callindia/html/hnvote/upvote.php on line 14

I would consider removing it, it seems to be broken on this website too: http://hnlike.com/

SWFObject "preventing me" from viewing the SWF

Running as JavaScript works, but for some reason, trying to run as a SWF does not work for me. I believe SWFObject is standing in my way; this may be due to me using Ubuntu, and Flash not "officially supported" by Linux any more. I'm still unclear on what version or name or who is in charge of the "replacement" used by us Linux users.

All I see is this:

Screenshot from 2014-05-09 23 47 55

However, I can look at the HTML, manually dig out the URL to the compiled SWF, and open that (which runs just fine):

No flash

Default page content for non flash devices

Metadata cannot be extracted from fields and statics

I have the following sample (from http://haxe.org/manual/lf-metadata.html, slightly modified)

import haxe.rtti.Meta;

@author("Nicolas")
@debug
class MyClass {
    @author("Nicolas")
    @range(1, 8)
    var value:Int;

    @broken
    @:noCompletion
    static function method() { }
}

class Test {
    static public function main() {
        trace(Meta.getType(MyClass)); // { author : ["Nicolas"], debug : null }
        trace(Meta.getFields(MyClass)); // [1,8]
        trace(Meta.getStatics(MyClass)); // { broken: null }
    }
}

Compiling with Haxe to JavaScript and running with Node gives the following output:

{ author: [ 'Nicolas' ], debug: null }
{ value: { author: [ 'Nicolas' ], range: [ 1, 8 ] } }
{ method: { broken: null } }

Similarly, compiling with Haxe and running with Neko gives the following output:

Test.hx:17: { debug => null, author => [Nicolas] }
Test.hx:18: { value => { range => [1,8], author => [Nicolas] } }
Test.hx:19: { method => { broken => null } }

On try.haxe.org running the code (http://try.haxe.org/#8cFb8) gives the following output:

Object {author: Array[1], debug: null}
Object {}
Object {} 

That is, the result from Meta.getType(MyClass) is correct but the result from Meta.getFields(MyClass) and Meta.getStatics(MyClass) is incorrect.

default code

I would love to alter the default code like this. I mostly want to test/compare things in this editor, then log them. This outputs to Javascript console but also appends to page. It's a small change, but improves usability for me.

class Test {
    static function main() {
        log("Haxe is great!");
    }

    static function log(value:Dynamic) {
        #if js
        new js.JQuery("body").append(value + "<br/>");
        #end
        trace(value);
    }
}

fullscreen

edit code in fullscreen

open result window in new tab in full screen

"Simple" mode

Would it make sense to have a simple mode that would hide the Test class declaration and the main entry point?

Cannot test local on windows

I have xampp installed and have setup everything like described. Everything works, except I cannot run any program. Everything does get stored in the tmp-folder and I also can get it back using deeplinks and the embed, but when I press "build+run" it says:

Build failure. 
Class not found : Test

Any pointers on how to solve this?

Disable rich editor on iOS

Sorry for this first world issue. The editor does not work nicely on iOS (on my iPad). For example you cannot copy/paste stuff.
Can the color highlighting be disabled?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.