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 map2_1[A,B,C](a: Option[A], b: Option[B])(f: (A, B) => C): Option[C] = | |
| for { | |
| a1 <- a | |
| b1 <- b | |
| } yield f(a1,b1) |
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
| myApp.filter('trustAsHtml', function ($sce) { | |
| return function (input) { | |
| return $sce.trustAsHtml(input); | |
| } | |
| }) | |
| HTML | |
| <p ng-bind-html="messageHTML | trustAsHtml"> |
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 mod: Parser[String] = "model" ~ ident ^^ ident.toString() | |
| scala: type mismatch; | |
| found : String | |
| required: ModelCombinator.this.~[String,String] => String | |
| def mod: Parser[String] = "model" ~ ident ^^ ident.toString() | |
| ^ |
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
| class ModelCombinator extends JavaTokenParsers { | |
| def mod: Parser[Any] = "model" ~ ident ^^ { | |
| case x => println("Hoping for string value of ident " + x.toString()) | |
| } | |
| def model: Parser[Any] = "model" ~ ident ~ "{" ~ rep(member) ~ "}" | |
| def member: Parser[Any] = ident ~ ":" ~ ident ~ "@" ~ ("eager" | "lazy") ~ relation.? ~ ";" |
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
| /** | |
| * Created with IntelliJ IDEA. | |
| * User: q | |
| * Date: 1/3/14 | |
| * Time: 4:04 PM | |
| * To change this template use File | Settings | File Templates. | |
| */ | |
| import scala.util.parsing.combinator._ | |
| class ProgramAST; |
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
| allMemberTypes.forall { | |
| memberType => if (!predefinedTypes.contains(memberType) && !userDefined.contains(memberType)) { | |
| Reporter.error("Oops! I couldn't find a type for " + memberType + " , searching all these types \n\n" + | |
| ( predefinedTypes ++ userDefined ) .toString ) | |
| } | |
| !predefinedTypes.contains(memberType) && !userDefined.contains(memberType) | |
| } |
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 getOppositeRelation(modelName: String, program: ProgramAST): Option[String] = { | |
| program.models map { | |
| model => | |
| model.members map { | |
| member => | |
| member.relationship match { | |
| case RelationAST(None, None) => { | |
| } | |
| case RelationAST(Some(fetchType), Some(nToM)) => { | |
| println("memberType (" + member.memberType + ") == modelName(" + modelName + ")"); |
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 getOppositeRelations(modelName: String, program: ProgramAST): List[String] = { | |
| var ret: List[String] = List() | |
| program.models map { | |
| model => | |
| model.members map { | |
| member => | |
| member.relationship match { | |
| case RelationAST(None, None) => { | |
| } |
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
| db.podsv2.find().forEach(function (pod) { | |
| pod.author = db.getSiblingDB('mlpishared').users.findOne({_id: pod.authorId}); | |
| print(pod.author.firstName); | |
| }); |
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
| name := "Yes" | |
| version := "1.0" | |
| libraryDependencies += "org.deeplearning4j" % "deeplearning4j-core" % "0.4-rc3.8" | |
| libraryDependencies += "org.nd4j" % "nd4j-x86" % "0.4-rc3.8" | |
| libraryDependencies += "org.nd4j" % "canova-api" % "0.0.0.16" |