Created
June 18, 2011 23:47
-
-
Save xuwei-k/1033604 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
package shibuyascala | |
import org.scalatra.ScalatraFilter | |
import net.liftweb.json._ | |
import net.liftweb.json.JsonDSL._ | |
class Main extends ScalatraFilter{ | |
val jsonToString = render _ andThen compact _ | |
val atndUrls = List( | |
2 -> 7695 | |
,3 -> 7856 | |
,4 -> 8091 | |
,5 -> 8231 | |
,6 -> 8384 | |
,7 -> 8639 | |
,8 -> 8894 | |
,9 -> 9104 | |
,10 -> 9337 | |
,11 -> 9607 | |
,12 -> 9889 | |
,13 -> 10100 | |
,14 -> 10291 | |
,15 -> 10312 | |
,16 -> 10564 | |
,17 -> 10882 | |
,18 -> 8724 | |
,19 -> 11517 | |
,20 -> 11539 | |
,21 -> 11660 | |
,22 -> 11954 | |
,23 -> 12177 | |
,24 -> 12454 | |
,25 -> 12637 | |
,26 -> 12929 | |
,27 -> 13145 | |
,28 -> 13318 | |
,29 -> 14345 | |
,30 -> 14720 | |
,31 -> 14924 | |
,32 -> 15061 | |
,33 -> 15482 | |
,34 -> 15597 | |
,35 -> 15869 | |
,36 -> 16122 | |
,37 -> 16263 | |
,38 -> 16703 | |
,39 -> 16753 | |
,40 -> 17068 | |
) | |
val ATND = "http://atnd.org/events/" | |
get("/all.json"){ | |
jsonToString{ | |
atndUrls.map{case (n,eventId) => | |
n.toString -> (ATND + eventId) | |
} | |
} | |
} | |
get("/all"){ | |
response.setContentType("text/html; charset=UTF-8") | |
<html > | |
<head> | |
<title>Shibuya Scala</title> | |
<meta charset="UTF-8" /> | |
</head> | |
<body>{ | |
atndUrls.map{case (n,eventId) => | |
<a href={ATND + eventId}>{ n }</a><br /> | |
}} | |
</body></html> | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment