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
    
  
  
    
  | protected case class Encrypted[A](action: Action[A]) extends Action[A] { | |
| def apply(req: Request[A]) = { | |
| EnvUtil.isCloud match { | |
| case true => | |
| req.headers.get("x-forwarded-proto") match { | |
| case Some("https") => action(req) | |
| case _ => redirectToHttps(req) | |
| } | |
| case _ => | 
  
    
      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
    
  
  
    
  | override def onRouteRequest(req: RequestHeader): Option[Action[_]] = | |
| super.onRouteRequest(req).map { | |
| case action: Action[_] => | |
| currentUserId(req) match { | |
| case None => | |
| req.path match { | |
| case p if isRestrictedPath(p) => // requires login | |
| Authenticated(action) | |
| case p if isEncryptedWhenLoggedOut(p) => // required HTTPS for user/ | |
| Encrypted(action) | 
  
    
      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
    
  
  
    
  | //~ INTERFACE ================================================================================= | |
| lazy val robots_yes = Assets.at("/public", "robots.txt") | |
| lazy val robots_no = Assets.at("/public", "robots.no.txt") | |
| lazy val robots = if (isProduction) robots_yes else robots_no | |
| def at(typeOf: String, file: String, ver: String = "") = { | |
| val path = typeOf match { | |
| case "js" => ("/public/javascripts", file) | |
| case "css" => ("/public/stylesheets", file) | 
  
    
      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
    
  
  
    
  | def login = | |
| Action(parse.urlFormEncoded) { | |
| implicit req => | |
| val body = req.body | |
| // validate timestamp (not older than 5 minutes) | |
| val tstamp = body("timestamp").head | |
| if (new DateTime((tstamp + "000").toLong).isBefore(new DateTime().minusMinutes(5))) | |
| Forbidden("timestamp invalid") | |
| else { | 
  
    
      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
    
  
  
    
  | object Compiler4CoffeeScript { | |
| import play.core.coffeescript._ | |
| import org.mozilla.javascript.JavaScriptException | |
| import play.core.coffeescript.CompilationException | |
| def compile(files: Array[File]): String = | |
| (files.map{ | |
| f => | |
| try { | 
  
    
      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
    
  
  
    
  | def load2(id1: String, id2: String) = Action { | |
| try { | |
| val dir = if (id1 == null) "" else id1.replaceAllLiterally("-", "_") + "." | |
| val file = id2.replaceAllLiterally("-", "_") | |
| val c = Class.forName("views.html.slides." + dir + file) | |
| val m = c.getMethod("render") | |
| Ok(m.invoke(null).asInstanceOf[Html]) | |
| } catch { | |
| case e => | 
  
    
      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
    
  
  
    
  | #!/usr/bin/env node | |
| /** | |
| * @license r.js 2.0.6 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved. | |
| * Available via the MIT or new BSD license. | |
| * see: http://github.com/jrburke/requirejs for details | |
| */ | |
| /* | |
| * This is a bootstrap script to allow running RequireJS in the command line | |
| * in either a Java/Rhino or Node environment. It is modified by the top-level | 
  
    
      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
    
  
  
    
  | console.time("total") | |
| S = require 'string' | |
| os = require 'os' | |
| fs = require 'fs' | |
| sys = require 'sys' | |
| mkdirp = require 'mkdirp' | |
| cluster = require 'cluster' | |
| less = require 'less' | |
| wrench = require 'wrench' | 
  
    
      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
    
  
  
    
  | scala> val n = 10 | |
| n: Int = 10 | |
| scala> "Bob is " + n + " years old" | |
| res0: String = Bob is 10 years old | |
| scala> "Bob is $n years old" | |
| res1: String = Bob is $n years old | |
| scala> s"Bob is $n years old" | 
  
    
      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
    
  
  
    
  | val usdQuote = future { connection.getCurrentValue(USD) } | |
| val chfQuote = future { connection.getCurrentValue(CHF) } | |
| val purchase = for { | |
| usd <- usdQuote | |
| chf <- chfQuote | |
| if isProfitable(usd, chf) | |
| } yield connection.buy(amount, chf) | |
| purchase onSuccess { |