Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
import scala.xml.NodeSeq | |
import net.liftweb.http.js._ | |
import net.liftweb.http.js.jquery._ | |
def $(exp: String): jQuery = $(JE.Str(exp)) | |
def $(exp: JsExp): jQuery = jQuery(exp) | |
case class jQuery(exp: JsExp) { |
private val _jqueryCssSelectRegex = """(^\S)+""".r | |
private val _matchChar = Set('*', '[', '^', '-') | |
def sel(exp: String, content: NodeSeq): CssSel = { | |
val selects = _jqueryCssSelectRegex.findAllMatchIn(exp).map(_.matched).toList | |
val (init, last) = | |
if (_matchChar.contains(selects.last.head)) | |
selects.dropRight(2) -> selects.takeRight(2).mkString(" ") | |
else |
object RichF { | |
implicit class RichF1[A, Z](val f: A => Z) extends AnyVal { | |
def map[Y](g: Z => Y): A => Y = | |
(a: A) => g(f(a)) | |
def flatMap[Y](g: Z => A => Y): A => Y = | |
(a: A) => g(f(a))(a) | |
} | |
implicit class RichF2[A, B, Z](val f: (A, B) => Z) extends AnyVal { | |
def map[Y](g: Z => Y): (A, B) => Y = |