This file contains 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> val seq = (1 to 10000000).view.filter(_ % 2 == 0).map(x => x+1) | |
seq: scala.collection.SeqView[Int,Seq[_]] = SeqViewFM(...) | |
scala> seq.take(10) | |
res0: scala.collection.SeqView[Int,Seq[_]] = SeqViewFMS(...) | |
scala> seq.take(10).force | |
res1: Seq[Int] = Vector(3, 5, 7, 9, 11, 13, 15, 17, 19, 21) | |
scala> val seq = (1 to 10000000).filter(_ % 2 == 0).map(x => x+1) |
This file contains 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
val time = Latency.measure[Unit](Kamon.metrics.histogram("awesomeHistogram")) | |
time(printInt(5)) | |
Latency.measure(Kamon.metrics.histogram("awesomeHistogram"))(printInt(5)) | |
def printInt(num: Int): Unit = { | |
print(num) | |
} |
This file contains 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 java.io.InputStream | |
import akka.actor.{ Actor, ActorRef, Props, ActorSystem } | |
case class ProcessStringMsg(lineNumber: Int, fileName: String, string: String, fileSender: Option[ActorRef], listener: ActorRef) | |
case class StringProcessedMsg(words: Integer, fileSender: Option[ActorRef]) | |
case class FileReference(fileName: String, stream: InputStream) | |
case class ProcessedFile(fileName: String, totalNumWords: Int, timeElapsed: Long, onCompleteSignal: Boolean) | |
case class CaptureStream(fileName: String, numOfWords: Int, lineNumber: Int, onCompleteSignal: Boolean) | |
case class StartProcessFileMsg() |
This file contains 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
/** | |
* Option Collections | |
* | |
* Some developers see Option as a safe replacement for null values, | |
* notifying users that the value may be missing and | |
* reducing the likelihood that its use will trigger a Null PointerException. | |
* Others see it as a safer way to build chains of operations, | |
* ensuring that only valid values will persist for the duration of the chain. | |
* | |
* The Option type is itself unimplemented but relies on two subtypes for the implementation: |
This file contains 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
Optional<String> optional = Optional.of("Bam"); | |
if(optional.isPresent()) | |
{ | |
System.out.println(optional.get()); //Bam | |
} | |
optional = Optional.empty(); | |
System.out.println(optional.orElse("test")); //test |
This file contains 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
Rails Active record | |
create new project | |
$rails new active_record | |
create model | |
$rails g model Manufacturer name:string | |
generate the game model | |
$rails g model Game name:string manufacturer:references |
This file contains 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
Under review as a conference paper at ICLR 2015 | |
MOVE EVALUATION IN GO USING DEEP | |
CONVOLUTIONAL NEURAL NETWORKS | |
Chris J. Maddison | |
University of Toronto |
This file contains 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
static boolean isAnagram(String s1, String s2) | |
{ | |
//convert string to lower case | |
s1 = s1.toLowerCase(); | |
s2 = s2.toLowerCase(); | |
if(s1.length() != s2.length()) | |
{ | |
return false; | |
} |
This file contains 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
{ | |
"header": [ | |
{ | |
"host": "lpas" | |
}, | |
{ | |
"connection": "close" | |
}, | |
{ | |
"tesla-version": "2" |
This file contains 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
>>> list(vertices) | |
[<Vertex: http://localhost:8182/graphs/graph/vertices/12>, <Vertex:http://localhost:8182/graphs/graph/vertices/40008>] |
NewerOlder