-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathmruby.html
More file actions
58 lines (57 loc) · 2.29 KB
/
mruby.html
File metadata and controls
58 lines (57 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!DOCTYPE html>
<html>
<head>
<title>
Emscripten: mruby
</title>
<style type="text/css" media="screen">
#editor-container {
margin: 1em 0;
height: 300px;
width: 80%;
}
#editor {
width: 100%;
height: 100%;
position: relative;
}
</style>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="events.js"></script>
<script src="webruby.js"></script>
</head>
<body>
<p>
This is the <a href="https://github.com/mruby/mruby">mruby</a> interpreter, compiled from C to JavaScript using <a href="http://emscripten.org">Emscripten</a>,
running in your browser (without any plugins).
</p>
<p>
<ul>
<li>The skeleton of this file is take from <a href="https://github.com/kripken/emscripten/blob/master/demos/lua.html">here</a>, a Lua interpreter running in a browser.</li>
<li>The source code is at <a href="https://github.com/xxuejie/mruby-web-irb">https://github.com/xxuejie/mruby-web-irb</a>.</li>
<li>Also feel free to check out my <a href="/">blog</a>!</li>
<li>NOTE: This is only a bare-metal example showing how to build a web IRB on top of webruby, for trying mruby source code in a browser, I stronly suggest you try <a href="http://joshnuss.github.io/mruby-web-irb/">this modern fork</a> by <a href="https://github.com/joshnuss">Joshua Nussbaum</a></li>
</ul>
</p>
<hr>
<div id="code-form">
<b>Enter some mruby code</b>:
<a id="submit-button" href="#">Submit</a><br><br>
<input id="clear-check" type="checkbox">Click this if you want to start a new irb(clear all current states) after submitting your code.</input>
<div></div>
<input id="clear-input" type="checkbox">Check this to clear editor after submitting.</input>
<div id="editor-container">
<div id="editor">5.times { puts "Ruby is awesome!" }</div>
</div>
</div>
<script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script>
<script>
var editor = ace.edit("editor");
editor.setTheme("ace/theme/monokai");
editor.getSession().setMode("ace/mode/ruby");
editor.getSession().setTabSize(2);
</script>
<hr>
<div id="output" style="font-family: Courier New,Courier,monospace;"></div>
</body>
</html>