Imagine that you've inherited this program:
import scala.util.Random
object SlowApp {| object Crypto { | |
| /** Sign a request as a user */ | |
| def sign(url: String, params: Map[String, String], token: String, secret: String): String = { | |
| val paramsToSign = params ++ commonParams ++ Map("auth_token" -> token) | |
| finalsign(url, paramsToSign, secret) | |
| } | |
| /** Sign a request as Ballero */ | |
| def appsign(url: String, params: Map[String, String]): String = { | |
| val paramsToSign = params ++ commonParams |
| import getopt, sys, os, re | |
| optlist, args = getopt.getopt(sys.argv[1:], "c:") | |
| if len(args) != 2: | |
| print "usage: " + sys.argv[0] + " [-c cookie] <url> <file> | bash" | |
| sys.exit(1) | |
| url, file = args |
| curl -XPUT 'http://localhost:9200/products/othertype/_mapping?pretty=true' -d'{ | |
| "othertype": { | |
| "properties": { | |
| "year": { "type": "long" }, | |
| "b": { "type": "boolean" } | |
| } | |
| } | |
| }' | |
| <p> | |
| <font size="5"> | |
| <font size="5"> | |
| <font size="5"> | |
| <font size="5"> | |
| <font size="5"> | |
| <font size="5"> | |
| <font size="5"> | |
| <font size="5"> | |
| <font size="5"> |
| The Godfather: | |
| (0, ('c47cdc01ae393cc1', 'The Godfather', 1285.2524694611532, 1996.0, 1996.0)) | |
| (1, ('14ad24bec9864311', 'The Godfather Part II', 247.03430466050014, 664.0, 2126.0)) | |
| (2, ('3f07609919cea6a1', 'Unforgiven', 66.8648447097107, 464.0, 2203.0)) | |
| (3, ('3d759a6cec209d51', 'Goodfellas', 52.01722828431214, 1069.0, 3324.0)) | |
| (4, ('3d8d7ee67be90ce1', 'Casino', 44.32755685131195, 582.0, 2429.0)) | |
| (5, ('fa57dfab448a0271', 'The Deer Hunter', 41.576119653738715, 437.0, 2244.0)) | |
| (6, ('b269bfba160411c1', 'The Good, the Bad and the Ugly', 39.582209420249114, 697.0, 2689.0)) | |
| (7, ('d79251b20619d5a1', 'Scarface', 35.78798419686481, 812.0, 2809.0)) |
| 74a75 | |
| > var fragment = document.createDocumentFragment(); | |
| 77c78 | |
| < document.body.appendChild(hintsDiv); | |
| --- | |
| > fragment.appendChild(hintsDiv); | |
| 92a94 | |
| > document.body.appendChild(fragment); |
| import dispatch._ | |
| def func = Http(host("exaadsfadsfmple.com") OK as.String) | |
| try { | |
| val rv = func.flatMap { _ => Promise(1) } | |
| rv() // Doesn't reach here, prints out message | |
| println("I'll never get here") | |
| } catch { | |
| case e: Exception => println("I'll catch this, but you'll still see the JRE printing a stack trace for a BG thread") | |
| } |
| 76 www.amazon.com P sophie the giraffe B000IDSLOG | |
| 4 www.amazon.co.uk P sophie the giraffe B000SOG7BY | |
| 2 www.diapers.com P sophie the giraffe 15640 | |
| 2 www.amazon.com P sophie the giraffe B00RYW27QM | |
| 1 www.amazon.com P sophie the giraffe B000SOG7BY |