Last active
December 23, 2015 07:19
-
-
Save jeffbaumes/6599647 to your computer and use it in GitHub Desktop.
Tangelo basic example
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
<!DOCTYPE html> | |
<head> | |
<title>Reverser</title> | |
<!-- Boilerplate Javascript --> | |
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script> | |
<script src="/js/tangelo.js"></script> | |
<!-- The app's Javascript --> | |
<script src="myapp.js"></script> | |
</head> | |
<body> | |
<div> | |
<!-- Our little form to submit the text --> | |
<h2>Reverser</h2> | |
<div class="form-inline"> | |
<input id="text" type="text"> | |
<button id="go" class="btn btn-default">Go</button> | |
</div> | |
<!-- A place to show the output --> | |
<div id="output"></div> | |
</div> | |
</body> |
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
$(function () { | |
$("#go").click(function () { | |
var text = $("#text").val(); | |
$.getJSON("myservice?text=" + encodeURIComponent(text), function (data) { | |
$("#output").text(data.reversed); | |
}); | |
}); | |
}); |
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
def run(text=""): | |
return {"reversed": text[::-1]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment