I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!
\
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
| [user] | |
| name = Your Name | |
| email = [email protected] | |
| [color] | |
| ui = true | |
| [core] | |
| excludesfile = ~/.gitignore_global | |
| editor = /usr/local/bin/mvim -f |
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 demo | |
| import akka.actor.{Props, ActorSystem} | |
| import akka.persistence.PersistentActor | |
| object PingPong extends App { | |
| case object Ball // The Command | |
| case object BallReceived // The Domain Event, represents a Fact, something that have already happened | |
| class Ping extends PersistentActor { |
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 demo | |
| import akka.actor.{Actor, Props, ActorSystem} | |
| object PingPong extends App { | |
| case object Ball | |
| class Ping extends Actor { | |
| var counter = 0 |
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
| $ ./bin/spark-shell | |
| 14/04/18 15:23:49 INFO spark.HttpServer: Starting HTTP Server | |
| 14/04/18 15:23:49 INFO server.Server: jetty-7.x.y-SNAPSHOT | |
| 14/04/18 15:23:49 INFO server.AbstractConnector: Started [email protected]:49861 | |
| Welcome to | |
| ____ __ | |
| / __/__ ___ _____/ /__ | |
| _\ \/ _ \/ _ `/ __/ '_/ | |
| /___/ .__/\_,_/_/ /_/\_\ version 0.9.1 | |
| /_/ |
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
| // Awesome enum example | |
| //http://stackoverflow.com/questions/116574/java-get-file-size-efficiently | |
| import java.io.*; | |
| import java.net.*; | |
| import java.util.*; | |
| public enum FileSizeBench { |
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
| // 1. Write a code snippet that sets a to an array of n random integers between 0 | |
| // (inclusive) and n (exclusive). | |
| val a = new Array[Int](10) //> a : Array[Int] = Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0) | |
| for(i <- 0 until a.length) a(i) = scala.util.Random.nextInt(10) | |
| a //> res0: Array[Int] = Array(9, 0, 5, 8, 6, 6, 3, 9, 0, 3) | |
| // 2. Write a loop that swaps adjacent elements of an array of integers. For example, | |
| // Array(1, 2, 3, 4, 5) becomes Array(2, 1, 4, 3, 5). | |
| val a = Array[Int](1,2,3,4,5) | |
| a //> res1: Array[Int] = Array(1, 2, 3, 4, 5) |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
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
| //================================================================== | |
| // SPARK INSTRUMENTATION | |
| //================================================================== | |
| import com.codahale.metrics.{MetricRegistry, Meter, Gauge} | |
| import org.apache.spark.{SparkEnv, Accumulator} | |
| import org.apache.spark.metrics.source.Source | |
| import org.joda.time.DateTime | |
| import scala.collection.mutable |
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 org.jsoup.Jsoup | |
| import org.jsoup.nodes.Element | |
| import scala.collection.JavaConversions._ | |
| System.setProperty("http.proxyHost", "xxx.xxx.xxx") | |
| val doc = Jsoup.connect("http://www.smh.com.au/business/markets/52-week-highs?page=-1").get() | |
| //doc.body() | |
| val elems = doc.select("#content > section > table > tbody > tr > th > a") | |
| val foo = for ( e <- elems) yield e.text |