forked from suztomo/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 53
/
import.scala
61 lines (49 loc) · 1.67 KB
/
import.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import com.yuroyoro.util._
import com.yuroyoro.util.io._
import com.yuroyoro.util.net._
import scala.io.Source
import scala.collection.JavaConversions._
import scala.xml._
import scala.xml.parsing.XhtmlParser
// import scala.util.matching.Regex
// import scala.collection.jcl.Conversions._
// import java.util.{List => JList, Map => JMap }
// import java.util.{Calendar,Date }
// // import _root_.com.yuroyoro.interactivehelp.Help._
// //
// type -->[A, B] = PartialFunction[A, B]
// object FileOut{
// import java.io.{Writer, OutputStreamWriter, FileOutputStream }
// def os(fileName:String):Writer =
// new OutputStreamWriter( new FileOutputStream( fileName ), "UTF-8")
// def apply( fileName:String, content:String ) = {
// val o = os( fileName )
// o.write( content )
// o.flush
// o.close
// }
// def apply( fileName:String, content:Seq[String] ) = {
// val o = os( fileName )
// content.foreach { c => o.write( c + "\n" ) }
// o.flush
// o.close
// }
// }
// class MapOrElseOption[A]( o:Option[A] ){
// def mapOrElse[B]( default : => B)( f:(A) => B ) = o match {
// case None => default
// case Some(x) => f(x)
// }
// }
// implicit def option2MapOrElseOption[A]( o:Option[A] ) = new MapOrElseOption( o )
// class HtmlNodeSeq( xml:NodeSeq ) {
// def class_?(className:String ) = xml filter{ e =>
// styleClass(e).split("\\s").contains(className)
// }
// def id_?( id:String ) = xml filter{ e =>
// (e \ "@id" text) == id
// }
// def styleClass( xml:NodeSeq ) = xml \ "@class" text
// def link( xml:NodeSeq ) = xml \ "@href" text
// }
// implicit def nodeSeq2HtmlNodeSeq( xml:NodeSeq ) = new HtmlNodeSeq( xml )