.length | jQuery 1.9 日本語リファレンス | js STUDIO
lengthの挙動というか、scriptタグを複数別々の場所に用意してjQueryがどのように動くかを確認したかった。
結果として、alertで出力される数値がインクリメントされていた。
.length | jQuery 1.9 日本語リファレンス | js STUDIO
lengthの挙動というか、scriptタグを複数別々の場所に用意してjQueryがどのように動くかを確認したかった。
結果として、alertで出力される数値がインクリメントされていた。
Eitherによるエラー処理 - エラー処理による分岐を減らす | Scala Cookbook
Right型の場合はmap内の関数を適用し、Leftの型の場合はmapの処理を無視してLeftの内容(この場合はエラー情報を)をそのまま返す。
環境は、Mac OSXと、2.10.3
scala> def parseInt(s:String) : Either[Exception, Int] = | try Right(s.toInt) catch { case e:Exception => Left(e) } parseInt: (s: String)Either[Exception,Int] scala> parseInt("128") res0: Either[Exception,Int] = Right(128) scala> parseInt("234A") res1: Either[Exception,Int] = Left(java.lang.NumberFormatException: For input string: "234A") scala> parseInt("49").right map { _.toFloat } res2: Product with Serializable with scala.util.Either[Exception,Float] = Right(49.0) scala> parseInt("ADF").right map { _.toFloat } res3: Product with Serializable with scala.util.Either[Exception,Float] = Left(java.lang.NumberFormatException: For input string: "ADF") scala> parseInt("ADF").left map { _.getMessage } res4: Product with Serializable with scala.util.Either[String,Int] = Left(For input string: "ADF") scala> parseInt("40").left map { _.getMessage } res5: Product with Serializable with scala.util.Either[String,Int] = Right(40)
Emacsで定義されているクラスや関数にジャンプする方法 | Act as Professional - hiroki.jp
Scala + Emacs + ctags - tototoshi の日記
--langdef=scala --langmap=scala:.scala --regex-scala=/^[ \t]*((abstract|final|sealed|implicit|lazy)[ \t]*)*(private|protected)?[ \t]*class[ \t]+([a-zA-Z0-9_]+)/\4/c,classes/ --regex-scala=/^[ \t]*((abstract|final|sealed|implicit|lazy)[ \t]*)*(private|protected)?[ \t]*object[ \t]+([a-zA-Z0-9_]+)/\4/c,objects/ --regex-scala=/^[ \t]*((abstract|final|sealed|implicit|lazy)[ \t]*)*(private|protected)?[ \t]*case class[ \t]+([a-zA-Z0-9_]+)/\4/c,case classes/ --regex-scala=/^[ \t]*((abstract|final|sealed|implicit|lazy)[ \t]*)*(private|protected)?[ \t]*case object[ \t]+([a-zA-Z0-9_]+)/\4/c,case objects/ --regex-scala=/^[ \t]*((abstract|final|sealed|implicit|lazy)[ \t]*)*(private|protected)?[ \t]*trait[ \t]+([a-zA-Z0-9_]+)/\4/t,traits/ --regex-scala=/^[ \t]*type[ \t]+([a-zA-Z0-9_]+)/\1/T,types/ --regex-scala=/^[ \t]*((abstract|final|sealed|implicit|lazy)[ \t]*)*def[ \t]+([a-zA-Z0-9_]+)/\3/m,methods/ --regex-scala=/^[ \t]*((abstract|final|sealed|implicit|lazy)[ \t]*)*val[ \t]+([a-zA-Z0-9_]+)/\3/l,constants/ --regex-scala=/^[ \t]*((abstract|final|sealed|implicit|lazy)[ \t]*)*var[ \t]+([a-zA-Z0-9_]+)/\3/l,variables/ --regex-scala=/^[ \t]*package[ \t]+([a-zA-Z0-9_.]+)/\1/p,packages/
$ /usr/bin/ctags -Re . --exclude target
excludeは別にあってもなくてもいい。