Skip to content

Instantly share code, notes, and snippets.

@bioaaaaass
bioaaaaass / Tree.scala
Created September 20, 2016 02:51 — forked from dholbrook/Tree.scala
Scala binary tree
/**
* D Holbrook
*
* Code Club: PO1
*
* (*) Define a binary tree data structure and related fundamental operations.
*
* Use whichever language features are the best fit (this will depend on the language you have selected). The following operations should be supported:
*
* Constructors
@bioaaaaass
bioaaaaass / gist:4f820862f24d2ddbe8c798f342239e88
Created August 5, 2016 04:02 — forked from cvogt/gist:9193220
Slick: Dynamic query conditions using the **MaybeFilter** (Updated to support nullable columns)
import scala.slick.lifted.CanBeQueryCondition
// optionally filter on a column with a supplied predicate
case class MaybeFilter[X, Y](val query: scala.slick.lifted.Query[X, Y]) {
def filter[T,R:CanBeQueryCondition](data: Option[T])(f: T => X => R) = {
data.map(v => MaybeFilter(query.filter(f(v)))).getOrElse(this)
}
}
// example use case
import java.sql.Date
@bioaaaaass
bioaaaaass / my_html_template.html
Created January 6, 2015 10:31
"HTML:myhtml Template"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-CN" lang="zh-CN">
<head>
<title>Setting File Title</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="zh-CN" />
<meta name="author" content="skydao" />
<meta name="Copyright" content="skydao" />
<meta name="description" content="描述内容" />
<meta http-equiv="refresh" content="10;url=http://yourlink" />
@bioaaaaass
bioaaaaass / my_html_template.html
Created January 6, 2015 10:24
"HTML:my_html_template.html"
title