I know scala is very powerful, but I think this code proofs to me that scala code is difficult to read. I'm a pro functional programmer, but scala mixes too many concepts.
'pseudo' Python url shorterner in 14 lines of code:
from webapp2 import RequestHandler
import redis
def shorten_url(url):
import base64
return base64.encode(url)[:7]
class Handler(RequestHandler):
def get(self, path):
self.redirect(redis.get(path))
def post(self, path):
redis.put(path, shorten_url(path))