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
| case class File(id: Int, path: String, fileType: String, size: Int, uid: Int) | |
| class Files(tag: Tag) extends Table[File](tag, "files") { | |
| def id = column[Int]("fid", O.PrimaryKey) | |
| def path = column[String]("filepath") | |
| def fileType = column[String]("filemime") | |
| def size = column[Int]("filesize") | |
| def uid = column[Int]("uid") | |
| def * = (id, path, fileType, size, uid) <> (File.tupled, File.unapply _) | |
| } |
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
| In Controller: | |
| def articleDetail(article: Article, page: Int)(implicit request: play.api.mvc.Request[Any]): Result = { | |
| Ok(views.html.mobile.article(article, page)) | |
| } | |
| In article template: | |
| @(article: drupalslick.data.Article, page: Int)(implicit request: play.api.mvc.Request[Any]) | |
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
| from math import sqrt, pow | |
| def distance(a, b): | |
| return sqrt(pow(a[0] - b[0],2) + pow(a[1] - b[1],2)) | |
| def bruteMin(points, current=float("inf")): | |
| if len(points) < 2: return current | |
| else: | |
| head = points[0] | |
| del points[0] |
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
| This does not work, please do not use this if you get to this via search | |
| object Node { | |
| import Connector.db | |
| def apply(nid: Int): Option[Node] = { | |
| db withSession { | |
| val ntype = Query(NodeMap).filter(_.nid is nid).map(_.ntype).firstOption | |
| ntype.map { typestring => |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>IApp</title> | |
| <%= stylesheet_link_tag "application" %> | |
| <%= javascript_include_tag "application" %> | |
| <%= csrf_meta_tags %> | |
| </head> |