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
| scala> def func(s:Option[String]) = s match{case Some(x) if x.size > 0 => x} | |
| func: (s: Option[String])String | |
| scala> def func(s:Option[String]) = s match{case Some(x) => x} | |
| <console>:7: warning: match may not be exhaustive. | |
| It would fail on the following input: None | |
| def func(s:Option[String]) = s match{case Some(x) => x} | |
| ^ | |
| func: (s: Option[String])String |
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
| package hemplant.rosalind.dna | |
| sealed abstract trait Nucleotide{ | |
| def complementary:Nucleotide = Nucleotide.complementary(this) | |
| } | |
| case object A extends Nucleotide | |
| case object T extends Nucleotide | |
| case object G extends Nucleotide | |
| case object C extends Nucleotide |
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
| import com.github.nscala_time.time.Imports._ | |
| import annotation.tailrec | |
| import org.joda.time.DateTimeConstants | |
| object Calculator extends App{ | |
| val start = nextMonday(DateTime.now.toLocalDate) | |
| val days = start :: Stream.iterate(start + 1.day)(_ + 1.day).takeWhile(_.getDayOfWeek != DateTimeConstants.MONDAY).toList | |
| val result = days.map { |
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
| Process: Xcode [742] | |
| Path: /Applications/Xcode6-Beta.app/Contents/MacOS/Xcode | |
| Identifier: com.apple.dt.Xcode | |
| Version: 6.0 (6194.21) | |
| Build Info: IDEFrameworks_KLONDIKE-6194021000000000~12 | |
| Code Type: X86-64 (Native) | |
| Parent Process: launchd [172] | |
| Responsible: Xcode [742] | |
| User ID: 502 |
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
| import scala.concurrent._ | |
| import ExecutionContext.Implicits.global | |
| import android.util.Log | |
| import android.widget.TextView | |
| class UIDemoActivity extends Activity { | |
| override def onCreate(bundle: Bundle) { | |
| super.onCreate(bundle) | |
| val tv = new TextView(this) |
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
| def process(command: String, keyPairFile: File, sshOption: String = "-o StrictHostKeyChecking=no -t -t"): Either[String, String] = { | |
| import sys.process._ | |
| try { | |
| Right(s"echo ${command}" #&& "echo exit" #> s"ssh ${sshOption} -i ${keyPairFile.getAbsolutePath} ec2-user@${publicDN}" !!) | |
| } catch { case e: Exception => Left(e.toString) } | |
| } | |
| def scp(file: File, keyPairFile: File, scpOption: String = "-o StrictHostKeyChecking=no"): Either[String, String] = { | |
| import sys.process._ | |
| try { |
NewerOlder