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
var Modes = { | |
INSERT_MODE:0, | |
COMMAND_MODE:1, | |
mode:0, | |
isInsert: function() { this.mode == this.INSERT_MODE }, | |
isCommand: function() { this.mode == this.INSERT_MODE }, | |
setMode: function(mode) { this.mode = mode } | |
} |
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
trait InterpolationContext { | |
implicit def str2interp(s: String) = new InterpolatedString(s) | |
class InterpolatedString(val s: String) { | |
def / = interpolate(s) | |
def identifier = s.substring(2, s.length - 1) | |
} | |
object Tokenizer { | |
def unapply(s: String): Option[Iterator[String]] = { |
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
import org.specs._ | |
import Relation._ | |
class RelationalSpec extends Specification { | |
"Any Relation" should { | |
"have a restrict operator to filter tuples" in { | |
type PT = {def name: String; def state: String; def city: String; def zipCode: Int} | |
var relVar = relation[PT](new {def name = "Nilanjan"; def state = "OH"; def city = "Columbus"; def zipCode = 43230}, | |
new {def name = "Manisha"; def state = "OH"; def city = "Westerville"; def zipCode = 43333}) | |
relVar = relVar where { _.city == "Columbus" } |
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
// 1. Start here. Observe this trait | |
trait Monad[M[_]] { | |
def flatMap[A, B](a: M[A], f: A => M[B]): M[B] | |
def unital[A](a: A): M[A] | |
} | |
// A simple data type, which turns out to satisfy the above trait | |
case class Inter[A](f: Int => A) | |
// So does this. |
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
import play.api._ | |
import play.api.test._ | |
import play.api.test.Helpers._ | |
trait Loggable { | |
protected def enableLog = { | |
Logger.configure( | |
Map("application.home" -> new java.io.File(".").getAbsolutePath), |
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
import scala.xml._ | |
object Entities { | |
trait RawAsset | |
trait VodAsset | |
trait Version | |
trait Title | |
trait Contribution | |
trait Genre | |
trait Rating |
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 plugin | |
import play.api._ | |
import play.api.mvc._ | |
import play.api.http.Writeable | |
import play.api.http.HeaderNames._ | |
import java.io.{ByteArrayInputStream, ByteArrayOutputStream} | |
import java.util.zip.GZIPOutputStream | |
import play.api.libs.concurrent.Promise |
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
import static javax.xml.stream.XMLStreamConstants.CHARACTERS; | |
import static javax.xml.stream.XMLStreamConstants.START_ELEMENT; | |
import static javax.xml.stream.XMLStreamConstants.END_DOCUMENT; | |
import java.io.FileOutputStream; | |
import java.io.FileReader; | |
import javax.xml.bind.JAXBContext; | |
import javax.xml.bind.Marshaller; | |
import javax.xml.bind.Unmarshaller; |
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 controllers | |
import play.api._ | |
import play.api.mvc._ | |
import play.api.libs.json._ | |
object Application extends Controller { | |
def index = Action { | |
Ok(views.html.index("Your new application is ready.")) |
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
//routes file | |
GET /ping/:message controllers.Application.restCall(message: String) | |
//Then my controller | |
object Application extends Controller { | |
case class SomeMessage(m: String) | |
implicit val someMessageFormat: Format[SomeMessage] = Json.format[SomeMessage] | |
OlderNewer