Skip to content

Commit

Permalink
really basic repl functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephan Boyer committed Jul 4, 2011
1 parent c6f4b8a commit 6753afd
Show file tree
Hide file tree
Showing 15 changed files with 422 additions and 120 deletions.
100 changes: 100 additions & 0 deletions ui/website/404.htm
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Julia - A fresh approach to technical computing.</title>
<link href="styles.css" rel="stylesheet" type="text/css" />
<link href="favicon.ico" rel="shortcut icon" />
<script type="text/javascript" src="jquery.js"></script>
<script>
// keep track of the minimum height of the content (the height of the longest column)
var min_content_height;

function set_column_heights() {
// set the height of all the columns to the height of the longest one
$('div#left-column').height(min_content_height);
$('div#right-column').height(min_content_height);
$('div#main').height(min_content_height);

// calculate how much taller the columns should be so the footer is at the bottom of the window
var padding = Math.max($(window).height()-($('#footer-bar').offset().top+$('#footer-bar').outerHeight(true)), 0);

// make the columns taller so the footer is on the bottom of the page
$('div#left-column').height(min_content_height+padding);
$('div#right-column').height(min_content_height+padding);
$('div#main').height(min_content_height+padding);
}

window.onload = function() {
// calculate the height of the longest column
min_content_height = Math.max($('div#left-column').height(), $('div#right-column').height());

// set the height of the columns appropriately
set_column_heights();
};

window.onresize = set_column_heights;
</script>
</head>
<body>
<div id="header-bar">
<header>
<a href="/"><img id="logo" src="images/logo_dark.png" alt="Julia Programming Language" /></a>
<nav>
<img id="slogan" src="images/slogan.png" alt="A fresh approach to technical computing." />
<div class="float-clear"> </div>
<a href="/">Home</a>
<a href="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/JuliaLang/julia">GitHub</a>
<a href="about.htm">About</a>
<a href="contact.htm">Contact</a>
<div class="float-clear"> </div>
</nav>
<div class="float-clear"> </div>
</header>
</div>
<div id="main">
<div id="left-column">
<h2>Julia Overview</h2>
<ul>
<li>Introduction</li>
<li>Getting Started</li>
<li>Numeric Primitives and Literals</li>
<li>Mathematical Operations</li>
<li>Complex and Rational Numbers</li>
<li>Strings</li>
<li>Functions</li>
<li>Control Flow</li>
<li>Variables and Scoping</li>
<li>Types</li>
<li>Methods</li>
<li>Conversion and Promotion</li>
<li>Arrays</li>
<li>Running External Programs</li>
<li>Parallel Computing</li>
<li>Metaprogramming</li>
<li>Calling C Code</li>
<li>Standard Library Reference</li>
</ul>
</div>
<div id="right-column">
<div class="error">
Oops! We can't find the page you requested.
</div>
<h1>A fresh approach to technical computing.</h1>
<p>Julia is a dynamic language with optional typing, multiple dispatch, and good performance, achieved using type inference and just-in-time (JIT) compilation, implemented using LLVM. It is multi-paradigm, combining features of imperative, functional, and object-oriented programming. Try it out!</p>
<textarea class="code-editor" name="terminal" rows="12" cols="70" autofocus="autofocus"></textarea>
</div>
<div class="float-clear"> </div>
</div>
<div id="footer-bar">
<footer>
<a href="http:https://web.mit.edu/"><img id="mit-logo" src="images/mit_logo.png" alt="MIT Logo" /></a>
<div style="text-align: center">
<p>A <span class="strong">fresh</span> approach to <span class="strong">technical computing.</span></p>
<p>Copyright &copy; 2011 Alan Edelman, Jeff Bezanson, et al.</p>
</div>
<div class="float-clear"> </div>
</footer>
</div>
</body>
</html>
Binary file removed ui/website/assets/logo.psd
Binary file not shown.
Binary file added ui/website/assets/logo_dark.psd
Binary file not shown.
Binary file added ui/website/assets/logo_light.psd
Binary file not shown.
Binary file added ui/website/assets/slogan.psd
Binary file not shown.
Binary file added ui/website/images/juliaset.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed ui/website/images/logo.png
Binary file not shown.
Binary file added ui/website/images/logo_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ui/website/images/logo_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ui/website/images/mit_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ui/website/images/slogan.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
147 changes: 126 additions & 21 deletions ui/website/index.htm
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,141 @@
<meta charset="utf-8" />
<title>Julia - A fresh approach to technical computing.</title>
<link href="styles.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="jquery.js"></script>
<link href="favicon.ico" rel="shortcut icon" />
</head>
<body>
<script type="text/javascript" src="jquery.js"></script>
<script>
// give the document some extra room so the user can scroll and
// see the entire page without the footer occluding the bottom
// keep track of the minimum height of the content (the height of the longest column)
var min_content_height;

function set_column_heights() {
// set the height of all the columns to the height of the longest one
$('div#left-column').height(min_content_height);
$('div#right-column').height(min_content_height);
$('div#main').height(min_content_height);

// calculate how much taller the columns should be so the footer is at the bottom of the window
var padding = Math.max($(window).height()-($('#footer-bar').offset().top+$('#footer-bar').outerHeight(true)), 0);

// make the columns taller so the footer is on the bottom of the page
$('div#left-column').height(min_content_height+padding);
$('div#right-column').height(min_content_height+padding);
$('div#main').height(min_content_height+padding);
}

window.onload = function() {
$('body').css('margin-bottom', $('#footer').outerHeight(false));
// calculate the height of the longest column
min_content_height = Math.max($('div#left-column').height(), $('div#right-column').height());

// set the height of the columns appropriately
set_column_heights();
};

window.onresize = set_column_heights;
</script>
<header>
<h1><a href="/"><img id="logo" src="images/logo.png" alt="Julia Programming Language" /></a></h1>
</header>
<nav>
<a href="/">Home</a>
<a href="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/JuliaLang/julia">GitHub</a>
<a href="about.htm">About</a>
<a href="about.htm">Contact</a>
<div id="nav-end"> </div>
</nav>
<script>
var terminal_data = "";

function poll()
{
$.ajax({
type: "POST",
url: "/repl.scgi",
success: callback,
dataType: "text",
cache: false
});
}

function callback(data, textStatus, jqXHR)
{
if (data != "")
{
terminal_data += data;
$("#terminal").html(terminal_data);
$("#terminal").scrollTop($("#terminal").prop("scrollHeight"));
}
setTimeout(poll, 500);
}

$(document).ready(function()
{
$("#terminal-form").submit(function(evt)
{
$.ajax({
type: "POST",
url: "http:https://localhost/repl.scgi",
data: {"terminal-input": $("#terminal-input").val()},
success: callback,
dataType: "text",
cache: false
});

$("#terminal-input").val("");
return false;
});

setTimeout(poll, 500);
});
</script>
</head>
<body>
<div id="header-bar">
<header>
<a href="/"><img id="logo" src="images/logo_dark.png" alt="Julia Programming Language" /></a>
<nav>
<img id="slogan" src="images/slogan.png" alt="A fresh approach to technical computing." />
<div class="float-clear"> </div>
<a href="/">Home</a>
<a href="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/JuliaLang/julia">GitHub</a>
<a href="about.htm">About</a>
<a href="contact.htm">Contact</a>
<div class="float-clear"> </div>
</nav>
<div class="float-clear"> </div>
</header>
</div>
<div id="main">
<h1>A fresh approach to technical computing.</h1>
<p>Julia is a dynamic language with optional typing, multiple dispatch, and good performance, achieved using type inference and just-in-time (JIT) compilation, implemented using LLVM. It is multi-paradigm, combining features of imperative, functional, and object-oriented programming. Try it out!</p>
<textarea name="terminal" rows="12" cols="70" autofocus="autofocus"></textarea>
<div id="left-column">
<h2>Julia Overview</h2>
<ul>
<li>Introduction</li>
<li>Getting Started</li>
<li>Numeric Primitives and Literals</li>
<li>Mathematical Operations</li>
<li>Complex and Rational Numbers</li>
<li>Strings</li>
<li>Functions</li>
<li>Control Flow</li>
<li>Variables and Scoping</li>
<li>Types</li>
<li>Methods</li>
<li>Conversion and Promotion</li>
<li>Arrays</li>
<li>Running External Programs</li>
<li>Parallel Computing</li>
<li>Metaprogramming</li>
<li>Calling C Code</li>
<li>Standard Library Reference</li>
</ul>
</div>
<div id="right-column">
<h1>A fresh approach to technical computing.</h1>
<p>Julia is a dynamic language with optional typing, multiple dispatch, and good performance, achieved using type inference and just-in-time (JIT) compilation, implemented using LLVM. It is multi-paradigm, combining features of imperative, functional, and object-oriented programming. Try it out!</p>
<form id="terminal-form">
<div id="terminal"></div>
<input class="input" id="terminal-input" type="text" autofocus="autofocus" required="required" />
</form>
</div>
<div class="float-clear"> </div>
</div>
<div id="footer">
<div id="footer-bar">
<footer>
<a href="http:https://web.mit.edu/"><img id="mit-logo" src="images/mit_logo.png" alt="MIT Logo" /></a>
<p id="copyright">Copyright &copy; 2011 Alan Edelman, Jeff Bezanson, et al.</p>
<div style="text-align: center">
<p>A <span class="strong">fresh</span> approach to <span class="strong">technical computing.</span></p>
<p>Copyright &copy; 2011 Alan Edelman, Jeff Bezanson, et al.</p>
</div>
<div class="float-clear"> </div>
</footer>
</div>
</body>
Expand Down
31 changes: 31 additions & 0 deletions ui/website/jquery.json.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

(function($){$.toJSON=function(o)
{if(typeof(JSON)=='object'&&JSON.stringify)
return JSON.stringify(o);var type=typeof(o);if(o===null)
return"null";if(type=="undefined")
return undefined;if(type=="number"||type=="boolean")
return o+"";if(type=="string")
return $.quoteString(o);if(type=='object')
{if(typeof o.toJSON=="function")
return $.toJSON(o.toJSON());if(o.constructor===Date)
{var month=o.getUTCMonth()+1;if(month<10)month='0'+month;var day=o.getUTCDate();if(day<10)day='0'+day;var year=o.getUTCFullYear();var hours=o.getUTCHours();if(hours<10)hours='0'+hours;var minutes=o.getUTCMinutes();if(minutes<10)minutes='0'+minutes;var seconds=o.getUTCSeconds();if(seconds<10)seconds='0'+seconds;var milli=o.getUTCMilliseconds();if(milli<100)milli='0'+milli;if(milli<10)milli='0'+milli;return'"'+year+'-'+month+'-'+day+'T'+
hours+':'+minutes+':'+seconds+'.'+milli+'Z"';}
if(o.constructor===Array)
{var ret=[];for(var i=0;i<o.length;i++)
ret.push($.toJSON(o[i])||"null");return"["+ret.join(",")+"]";}
var pairs=[];for(var k in o){var name;var type=typeof k;if(type=="number")
name='"'+k+'"';else if(type=="string")
name=$.quoteString(k);else
continue;if(typeof o[k]=="function")
continue;var val=$.toJSON(o[k]);pairs.push(name+":"+val);}
return"{"+pairs.join(", ")+"}";}};$.evalJSON=function(src)
{if(typeof(JSON)=='object'&&JSON.parse)
return JSON.parse(src);return eval("("+src+")");};$.secureEvalJSON=function(src)
{if(typeof(JSON)=='object'&&JSON.parse)
return JSON.parse(src);var filtered=src;filtered=filtered.replace(/\\["\\\/bfnrtu]/g,'@');filtered=filtered.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']');filtered=filtered.replace(/(?:^|:|,)(?:\s*\[)+/g,'');if(/^[\],:{}\s]*$/.test(filtered))
return eval("("+src+")");else
throw new SyntaxError("Error parsing JSON, source is not valid.");};$.quoteString=function(string)
{if(string.match(_escapeable))
{return'"'+string.replace(_escapeable,function(a)
{var c=_meta[a];if(typeof c==='string')return c;c=a.charCodeAt();return'\\u00'+Math.floor(c/16).toString(16)+(c%16).toString(16);})+'"';}
return'"'+string+'"';};var _escapeable=/["\\\x00-\x1f\x7f-\x9f]/g;var _meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'};})(jQuery);
1 change: 1 addition & 0 deletions ui/website/repl.scgi
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This file exists so Lighttpd doesn't return a 404 for this request. A request to this resource is actually handled by the SCGI server.
Loading

0 comments on commit 6753afd

Please sign in to comment.