git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git
cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
| function keepTrying(otherArgs, promise) { | |
| promise = promise||new Promise(); | |
| // try doing the important thing | |
| if(success) { | |
| promise.resolve(result); | |
| } else { | |
| setTimeout(function() { | |
| keepTrying(otherArgs, promise); |
| import java.awt.Color | |
| import java.io.File | |
| import java.io.IOException | |
| import org.gephi.data.attributes.api.AttributeColumn | |
| import org.gephi.data.attributes.api.AttributeController | |
| import org.gephi.data.attributes.api.AttributeModel | |
| import org.gephi.filters.api.FilterController | |
| import org.gephi.filters.api.Query | |
| import org.gephi.filters.api.Range | |
| import org.gephi.filters.plugin.graph.DegreeRangeBuilder.DegreeRangeFilter |
| def newTempFile() = new File(IoTmpDir, "JavaTestTmp-"+random.nextLong()) | |
| /* | |
| * Tries 10 times to find a nonexistent file. | |
| * Uses Streams to lazily go through a range, generating a fresh | |
| * file each time. | |
| */ | |
| val dir = Stream.range(1,10) | |
| .map { newTempFile() } | |
| .find(!_.exists) |
| case class GridCell(x: Int, y: Int) | |
| def exist(board: Array[Array[Char]], word: String): Boolean = { | |
| val deltaVector = List((0, -1), (0, 1), (1, 0), (-1, 0)) | |
| def inBounds(cell: GridCell) = cell.x >= 0 && cell.x < board.length && cell.y >= 0 && cell.y < board(0).length | |
| def dfs(word: List[Char], currentCell: GridCell, visited: List[GridCell]): Boolean = { | |
| word match { |
| final case class User private[domain] (userId: UserId, createdAt: Instant, name: String, email: Email) { | |
| def applyEvent(userEvent: UserEvent): Try[User] = userEvent match { | |
| case _: UserCreated => Failure(new IllegalStateException("User already created. Event cannot be applied.")) | |
| case event: NameUpdated => Success(copy(name = event.newName)) | |
| case event: EmailUpdated => Success(copy(email = event.newEmail)) | |
| } | |
| def process(userCommand: UserCommand): Try[List[UserEvent]] = userCommand match { | |
| case _: CreateUser => Failure(new IllegalStateException("User already created. Command cannot be processed.")) |
| package eventsourcing | |
| import java.time.Instant | |
| import cats._ | |
| import cats.data.Coproduct | |
| import cats.free.{Free, Inject} | |
| import cats.implicits._ | |
| import doobie.imports._ | |
| import fs2.Stream |
| import akka.actor.{ActorSystem, Scheduler} | |
| import com.astoncap.util.concurrent.Async._ | |
| import scala.concurrent.{ExecutionContext, Future, Promise} | |
| import scala.concurrent.duration.{Duration, FiniteDuration} | |
| import scala.util.Try | |
| trait Scheduling { | |
| implicit val scheduling: Scheduling = this |
| package com.softwaremill.monadvalidation.lib | |
| import cats.Monad | |
| import cats.data.EitherT | |
| import scala.language.higherKinds | |
| trait ValidationResultLib[M[_]] { | |
| type ValidationResult[F, S] = EitherT[M, F, S] |