We'll exchange important info over PGP.
I am using this browser-based tool:
http://ianpurton.com/online-pgp/
I generated new keys there. I recommend you do the same (don't use your normal keys on your machine).
| object CardQuestions { | |
| case class Card(number: Int, color: String) | |
| val cards = Seq( | |
| Card(5, "red"), | |
| Card(7, "red"), | |
| Card(3, "black")) | |
| // Do the cards all have the same color? |
| package org.hyperscala.hello | |
| import org.scalatest.WordSpec | |
| import org.scalatest.Matchers | |
| import org.scalatest.BeforeAndAfter | |
| class HelloPageTest extends WordSpec with Matchers with BeforeAndAfter { | |
| "HelloPage" when { | |
| "when rendered" should { |
| object PositiveIntApp extends App { | |
| // The class Option[T] allows us to eventually wrap around a value. | |
| // Instances of Option[T] *could* have a value, or not. | |
| // | |
| // If they have a value, we are dealing with a Some[T], which is a | |
| // subclass of Option[T]. | |
| // | |
| // If the don't have a value, we are dealing with a None, which is | |
| // a special singleton instance of Option. |
We'll exchange important info over PGP.
I am using this browser-based tool:
http://ianpurton.com/online-pgp/
I generated new keys there. I recommend you do the same (don't use your normal keys on your machine).
| package org.scalavienna.refactoringdojo.gameoflife | |
| import org.scalatest.FunSuite | |
| import org.scalatest.Matchers | |
| import org.scalatest.exceptions.TestFailedException | |
| import scala.Array.canBuildFrom | |
| import scala.Array.fallbackCanBuildFrom | |
| /** | |
| * As a general rule, don't remove test-cases. You are free to add, though. |
| package org.scalavienna.refactoringdojo.gameoflife | |
| case class Pos(col: Int, row: Int) { | |
| def +(other: Pos): Pos = Pos(col + other.col, row + other.row) | |
| } | |
| case class Board(liveCells: Seq[Pos], size: Int) { | |
| def isLiveCell(p: Pos) = liveCells.contains(p) | |
| def nextIteration = BoardCalculator.nextIteration(this) |
| import scala.util.Random | |
| /** | |
| * @author Sebastian Nozzi | |
| */ | |
| object RaffleApp extends App with HelperMethods { | |
| lazy val numberCandidates: Set[Int] = { | |
| val allNumbers = (1 to 17).toSet | |
| val numbersThatWonSomething = Set[Int]() |
| class Event { | |
| } | |
| class SomeComponent { | |
| // Q: How to express the type of _callback? | |
| var _callback = (Event e) { /* dummy implementation */}; |
| val jsonStrToSend = "" | |
| val serverUrl = "" | |
| def handleAjaxError(jqXHR: JQueryXHR, textStatus: String, errorThrow: String): Unit = { | |
| println("Error while performing AJAX POST") | |
| } | |
| def handleAjaxSuccess(data: js.Any, textStatus: String, jqXHR: JQueryXHR): Unit = { | |
| val jsonFromServer = jqXHR.responseText | |
| println(s"Got from server: $jsonFromServer") |