-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-code.html
49 lines (47 loc) · 1.34 KB
/
run-code.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Run Ruby code in the browser</title>
<script src="browser.script.iife.js"></script>
<link rel="stylesheet" href="assets/codemirror.css">
<script src="assets/codemirror.js"></script>
<script src="assets/codemirror-ruby.js"></script>
<style>
#output {
white-space: pre-wrap;
margin-top: 20px;
}
.spinner {
border: 4px solid rgba(0, 0, 0, 0.1);
width: 40px;
height: 40px;
border-radius: 50%;
border-left-color: #09f;
animation: spin 1s ease infinite;
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
</style>
</head>
<body>
<h1>Code Runner</h1>
<div id="spinner" class="spinner"></div>
<textarea id="ruby-code" rows="10" cols="50">
document = JS.global.document
div = document.createElement("div")
div.innerHTML = "Hello World!"
document.body.appendChild(div)
</textarea><br>
<button id="run-code">Run Code</button>
<div id="output"></div>
<script type="text/ruby" src="runCode.rb" data-eval="async"></script>
</body>
</html>