Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
87 lines (72 sloc) 2.69 KB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Instant</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<!-- Le styles -->
<link href="/css/bootstrap.css" rel="stylesheet">
<link href="/css/bootstrap-responsive.css" rel="stylesheet">
<link href="/css/app.css" rel="stylesheet">
</head>
<body>
<div class="row-fluid">
<div class="span12">
<div class="row-fluid">
<div class="left">
<div id="editor">def binary_search(search, array)
low = 0
high = array.length - 1
end
binary_search('c', ['a', 'b', 'c', 'd', 'e', 'f'])</div>
</div>
<div class="right">
<pre id="output">
</pre>
</div>
</div>
</div>
</div>
<a href="http://github.com/siuying/instant"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://a248.e.akamai.net/assets.github.com/img/7afbc8b248c68eb468279e8c17986ad46549fb71/687474703a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub"></a>
<script src="/js/jquery.min.js"></script>
<script src="/js/bootstrap.min.js"></script>
<script src="/js/coffee-script.js"></script>
<script src="/js/ace.js" type="text/javascript" charset="utf-8"></script>
<script src="/js/theme-twilight.js" type="text/javascript" charset="utf-8"></script>
<script src="/js/mode-ruby.js" type="text/javascript" charset="utf-8"></script>
<script type="text/coffeescript">
$ ->
editor = ace.edit("editor")
Ruby = require("ace/mode/ruby").Mode
editor.getSession().setMode(new Ruby())
editor.setTheme("ace/theme/twilight")
editor.getSession().setTabSize(2)
editor.getSession().setUseSoftTabs(true)
compile = ->
val = editor.getSession().getValue()
$.ajax
type: 'POST'
url: '/compile'
data:
source: val
success: (data) ->
$(".err-msg").remove()
if data.result
$("#output").text(data.result)
else
$("#output").text("(no output)")
$("#output").append("\nreturn #{data.return_value}")
if data.status == "error" && data.message
$("#output").after "<div class='alert alert-error err-msg'>#{data.message}</div>"
error: (x, t, e) ->
console.log x, t, e
$(".err-msg").remove()
$("#output").after "<div class='alert alert-error err-msg'>#{x.responseText}</div>"
dataType: 'json'
compile()
editor.getSession().on 'change', compile
</script>
</body>
</html>
Something went wrong with that request. Please try again.