Skip to content

Commit

Permalink
Revert "destroyed legacy try ruby"
Browse files Browse the repository at this point in the history
This reverts commit b64abd7.
  • Loading branch information
Sophrinix committed Dec 29, 2010
1 parent b64abd7 commit b072332
Show file tree
Hide file tree
Showing 31 changed files with 4,744 additions and 0 deletions.
2 changes: 2 additions & 0 deletions public/.gitignore
@@ -0,0 +1,2 @@
tmp/

4 changes: 4 additions & 0 deletions public/blank.html
@@ -0,0 +1,4 @@
<html>
<body>
</body>
</html>
4 changes: 4 additions & 0 deletions public/comics.txt
@@ -0,0 +1,4 @@
Achewood: http://achewood.com/
Dinosaur Comics: http://qwantz.com/
Perry Bible Fellowship: http://cheston.com/pbf/archive.html
Get Your War On: http://mnftiu.cc/
96 changes: 96 additions & 0 deletions public/es_index.html
@@ -0,0 +1,96 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>try ruby! (en tu navegador)</title>
<script type="text/javascript" src="/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="/js/mouseapp_2.js"></script>
<script type="text/javascript" src="/js/mouseirb_2.js"></script>

<script type="text/javascript" src="/js/irb.js"></script>
<style type="text/css">
@import '/site.css';
</style>
</head>
<body>

<div id="container">
<div id="header"><img src="/images/header.png" /></div>
<div id="content">
<div id="lilBrowser">
<div id="lbTitlebar">

<h3 id="lbTitle">A Popup Browser</h3>
<p id="lbClose">[<a href="javascript:void(window.irb.options.popup_close());">x</a>]</p>
</div>
<iframe width="500" height="400" src="about:blank" id="lbIframe"></iframe>
</div>
<div id="shellwin">

<div id="terminal">
<div id="irb"></div>
</div>
</div>
<div id="helpstone">
<div class="stretcher chapmark">
<h3>¿Tienes 15 minutos? ¡Prueba Ruby ahora mismo!</h3>
<p>Ruby es un lenguaje de programación de Japón
(disponible en <a href="http://ruby-lang.org" target="_new">ruby-lang.org</a>)
que está revolucionando la web.
La belleza de Ruby se encuentra en su balance entre la simplicidad y el poder.</p>

<p>Prueba código Ruby en el prompt de arriba. Además de los métodos
originales de Ruby, los siguientes comandos están disponibles:</p>
<ul class="commands">
<li><strong>help</strong>
Empieza el tutorial interactivo de 15 minutos. ¡Creeme, es muy básico!</li>
<li><strong>help 2</strong>
Salta al capítulo 2.</li>

<li><strong>clear</strong>
Limpia la pantalla. Útil si tu navegador empieza a alerdarce.
Tu historial de comandos será recordado.</dd>
<li><strong>back</strong>
Retrocede una pantalla en el tutorial.</li>
<li><strong>reset</strong>
Resetea el interprete. (o <b>Ctrl-D</b>!)</li>
<li><strong>next</strong>
Te permite saltear la siguiente lección</li>

<li><strong>time</strong>
Detiene el reloj. Imprime cuanto tiempo tu sesión estuvo abierta.</li>
</ul>
<p>Si te pasa de dejar o refrescar la página, tu sesión seguirá aquí a menos que
se deje inactiva por diez minutos.</p>
<br />
<div class="answer"></div>
</div>

</div>
<div class="note">¿Atrapado en los dos puntos? Unas comillas o algo fue dejado abierto. Escribe: <strong>reset</strong> o aprieta <strong>Ctrl-D</strong>.</div>
</div>
<div id="footer"><img src="/images/footer.png" /></div>
<p>This place <del>was sired by <a href="http://whytheluckystiff.net">why the lucky stiff</a>.
Please contact me using the email address at that link.</del><add>is maintained by Andrew McElroy and David Miani. For support issues, please post a ticket or contact Sophrinix on <a href="http://github.com/Sophrinix/TryRuby">github</a>.<br /> Por asuntos de traducción, mandar un ticket o contactarse con Cristian Re (leizzer) en <a href="http://github.com/leizzer/TryRuby_es">Github</a>.</add>
</p>

</div>
<input class="keyboard-selector-input" type="text" id="irb_input" autocomplete="off" />

<!-- Putting the Google Analytics Code Here. Google Likes this to be in the header, but I can't bare
putting my code though that. Expect This to become it's own .js file in the future.
Replace the UA code if your hosting your own copy -->

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-2365371-3");
pageTracker._trackPageview();
} catch(err) {}</script>

<!-- end of GA code -->
</body>
</html>
Binary file added public/images/background.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/footer.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/header.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions public/images/index.html
@@ -0,0 +1,8 @@
<html>
<head>
<meta http-equiv="refresh" content="2;url=http://tryruby.sophrinix.com">
</head>
<body>
<p> you shouldn't be here.. kicking you out! </p>
</body>
</html>
Binary file added public/images/tile.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
96 changes: 96 additions & 0 deletions public/index.html
@@ -0,0 +1,96 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>try ruby! (in your browser)</title>
<script type="text/javascript" src="/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="/js/mouseapp_2.js"></script>
<script type="text/javascript" src="/js/mouseirb_2.js"></script>

<script type="text/javascript" src="/js/irb.js"></script>
<style type="text/css">
@import '/site.css';
</style>
</head>
<body>

<div id="container">
<div id="header"><img src="/images/header.png" /></div>
<div id="content">
<div id="lilBrowser">
<div id="lbTitlebar">

<h3 id="lbTitle">A Popup Browser</h3>
<p id="lbClose">[<a href="javascript:void(window.irb.options.popup_close());">x</a>]</p>
</div>
<iframe width="500" height="400" src="about:blank" id="lbIframe"></iframe>
</div>
<div id="shellwin">

<div id="terminal">
<div id="irb"></div>
</div>
</div>
<div id="helpstone">
<div class="stretcher chapmark">
<h3>Got 15 minutes? Give Ruby a shot right now!</h3>
<p>Ruby is a programming language from Japan
(available at <a href="http://ruby-lang.org" target="_new">ruby-lang.org</a>)
which is revolutionizing the web.
The beauty of Ruby is found in its balance between simplicity and power.</p>

<p>Try out Ruby code in the prompt above. In addition
to Ruby's builtin methods, the following commands are available:</p>
<ul class="commands">
<li><strong>help</strong>
Start the 15 minute interactive tutorial. Trust me, it's very basic!</li>
<li><strong>help 2</strong>
Hop to chapter two.</li>

<li><strong>clear</strong>
Clear screen. Useful if your browser starts slowing down.
Your command history will be remembered.</dd>
<li><strong>back</strong>
Go back one screen in the tutorial.</li>
<li><strong>reset</strong>
Reset the interpreter if you get too deep. (or <b>Ctrl-D</b>!)</li>
<li><strong>next</strong>
Allows you to skip to the next section of a lesson.</li>

<li><strong>time</strong>
A stopwatch. Prints the time your session has been open.</li>
</ul>
<p>If you happen to leave or refresh the page, your session will still be here for
unless it is left inactive for ten minutes.</p>
<br />
<div class="answer"></div>
</div>

</div>
<div class="note">Trapped in double dots? A quote or something was left open. Type: <strong>reset</strong> or hit <strong>Ctrl-D</strong>.</div>
</div>
<div id="footer"><img src="/images/footer.png" /></div>
<p>This place <del>was sired by <a href="http://whytheluckystiff.net">why the lucky stiff</a>.
Please contact me using the email address at that link.</del><add>is maintained by Andrew McElroy and David Miani. For support issues, please post a ticket or contact Sophrinix on <a href="http://github.com/Sophrinix/TryRuby">github</a>. </add>
</p>

</div>
<input class="keyboard-selector-input" type="text" id="irb_input" autocomplete="off" />

<!-- Putting the Google Analytics Code Here. Google Likes this to be in the header, but I can't bare
putting my code though that. Expect This to become it's own .js file in the future.
Replace the UA code if your hosting your own copy -->

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-2365371-3");
pageTracker._trackPageview();
} catch(err) {}</script>

<!-- end of GA code -->
</body>
</html>
37 changes: 37 additions & 0 deletions public/irb.cgi
@@ -0,0 +1,37 @@
#!/usr/bin/env ruby

require 'tryruby.rb'
require 'cgi'
require 'cgi/session'
require 'cgi/session/pstore'

class TryRubyCGISession# < TryRuby::Session
attr_accessor :cgi, :session

def initialize
@session = CGI::Session.new @cgi = CGI.new,
'database_manager' => CGI::Session::PStore, # use PStore
'session_key' => 'trb_sess_id', # custom $session key
'session_expires' => Time.now + 60 * 60, # 60 minute timeout
'prefix' => 'pstore_sid_', #Pstore option
'tmpdir' => 'tmp' # Temp Directory for sessions


@session['start_time'] ||= Time.now
@session['current_statement'] ||= ''
@session['past_commands'] ||= ''
end

def header
@cgi.header 'text/plain'
end

[:current_statement, :past_commands, :start_time].each do |accessor|
define_method(accessor) { @session[accessor.to_s] }
define_method(:"#{accessor.to_s}=") { |new_val| @session[accessor.to_s] = new_val }
end
end

TryRuby.session = TryRubyCGISession.new

print TryRuby.session.header + TryRuby.run_line(TryRuby.session.cgi['cmd']).format
8 changes: 8 additions & 0 deletions public/js/index.html
@@ -0,0 +1,8 @@
<html>
<head>
<meta http-equiv="refresh" content="2;url=http://tryruby.sophrinix.com">
</head>
<body>
<p> you shouldn't be here.. kicking you out! </p>
</body>
</html>
110 changes: 110 additions & 0 deletions public/js/irb.js
@@ -0,0 +1,110 @@
//
// Copyright (c) 2008 why the lucky stiff
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
// SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
// OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
var allStretch;
var helpPages;
var chapPages;
var defaultPage;
var toot = window.location.search.substr(1)

//the main function, call to the effect object
function dumpAlert(obj) {
props = [];
for ( var i in obj ) {
props.push( "" + i + ": " + obj[i] );
}
alert( props );
}
window.onload = function() {
defaultPage = $('#helpstone .stretcher').html();

window.irb = new MouseApp.Irb('#irb', {
rows: 13,
name: 'IRB',
greeting: "%+r Interactive ruby ready. %-r",
ps: '\033[1;31m>>\033[m',
user: 'guest',
host: 'tryruby',
// original: irbUrl: '/irb',
irbUrl: '/irb.cgi',
init: function () {
helpPages = $(".stretcher");
chapPages = new Array();
for (var i = 0; i < helpPages.length; i++ ) {
var cls = helpPages[i].className.split(' ');
for (var j = 0; j < cls.length; j++) {
if (cls[j] == 'chapmark') {
chapPages.push([i, helpPages[i]]);
break;
}
}
}
},
loadTutorial: function (id, instruct) {
$.ajax({
url: '/tutorials/' + id + '.html',
type: 'GET',
complete: function (r) {
$('#helpstone').html("<div class='stretcher chapmark'>" + defaultPage + "</div>" + r.responseText);
window.irb.init();
window.irb.showHelp(0);
}
});
},
showChapter: function (n) {
if (n >= chapPages.length) return;
this.setHelpPage(chapPages[n][0], chapPages[n][1]);
},
showHelp: function (n) {
if (n >= helpPages.length) return;
this.setHelpPage(n, helpPages[n]);
},
popup_goto: function (u) {
$('#lilBrowser').show().css({left: '40px', top: '40px'});
$('#lbIframe').attr('src', u);
},
popup_make: function (s) {
$('#lilBrowser').show().css({left: '40px', top: '40px'});
$('#lbIframe').get(0).onIframeLoad = function () {
alert($(this).html());
alert("$(this).html()");
return s;
};
//$('#lbIframe').attr({src: '/blank.html'});
src = s.replace(/\\/g, "\\\\").replace(/\"/g, "\\\"");
$('#lbIframe').attr({src: "javascript:\"" + src + "\""});
// $('#
},
popup_close: function () {
$('#lilBrowser').hide();
}
});

if ( !toot ) {
toot = 'intro';
}
try {
window.irb.options.loadTutorial( toot, true );
} catch (e) {}
}
19 changes: 19 additions & 0 deletions public/js/jquery-1.3.2.min.js

Large diffs are not rendered by default.

0 comments on commit b072332

Please sign in to comment.