Skip to content

Instantly share code, notes, and snippets.

Shehaaz shehaaz

Block or report user

Report or block shehaaz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@shehaaz
shehaaz / WhatIsASeqView.scala
Last active Jul 29, 2016
What is a SeqView in Scala
View WhatIsASeqView.scala
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)
View curry.scala
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)
}
View AkkaStreamingFile.scala
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()
@shehaaz
shehaaz / Options.scala
Created Mar 28, 2016
Scala Options Explained
View Options.scala
/**
* 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:
@shehaaz
shehaaz / Optional.java
Created Jan 5, 2016
Optional in Java 8
View Optional.java
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
View active_record.rb
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
View deepmind
Under review as a conference paper at ICLR 2015
MOVE EVALUATION IN GO USING DEEP
CONVOLUTIONAL NEURAL NETWORKS
Chris J. Maddison
University of Toronto
@shehaaz
shehaaz / AnagramChecker.java
Last active Aug 29, 2015
Recursive Anagram Checker in Java
View AnagramChecker.java
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;
}
View IncomingRequestBlob.json
{
"header": [
{
"host": "lpas"
},
{
"connection": "close"
},
{
"tesla-version": "2"
View Titan.py
>>> list(vertices)
[<Vertex: http://localhost:8182/graphs/graph/vertices/12>, <Vertex:http://localhost:8182/graphs/graph/vertices/40008>]
You can’t perform that action at this time.