Created
December 7, 2009 06:10
-
-
Save marshall/250660 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<style> | |
#square { | |
background-color: black; | |
color: white; | |
font-size: 30pt; | |
padding: 10px; | |
width: 350px; | |
} | |
#num { | |
font-size: 30pt; | |
background-color: black; | |
color: white; | |
padding: 10px; | |
width: 100px; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="square">0</div> | |
<input id="num" type="text"/> | |
<button id="button" onclick="showSquares()">Show squares</button> | |
<script> | |
function showSquares() { | |
// this would be for Windows | |
//var php = Titanium.App.appURLToPath("ti://php/php.exe"); | |
// this would be for OSX / Linux | |
var php = "/usr/bin/php"; | |
var script = Titanium.App.appURLToPath("app://square.php"); | |
var num = document.getElementById("num").value; | |
var process = Titanium.Process.createProcess([php, script, num]); | |
process.setOnRead(function(event) { | |
document.getElementById("square").innerHTML = event.data.toString(); | |
}); | |
process.setOnExit(function() { | |
document.getElementById("button").disabled = null; | |
}); | |
process.launch(); | |
document.getElementById("button").disabled = "disabled"; | |
} | |
</script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$orig = $argv[1]; | |
$n = $orig; | |
for ($i = 0; $i < 30; $i++) { | |
$n *= $orig; | |
echo "$orig^".($i+2)." = ".$n; | |
sleep(1); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment