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
Verifying that +bhudgeons is my openname (Bitcoin username). https://onename.io/bhudgeons |
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
class A { | |
def f(x: Int, y: Int) = ((x, y)) | |
def name = "A" | |
} | |
class B extends A { | |
override def f(y: Int, x: Int) = ((y, x)) | |
override def name="B" | |
} |
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 akka.actor.ActorSystem | |
import akka.actor.Props | |
import akka.actor.Actor | |
import akka.actor.ActorRef | |
import akka.pattern.ask | |
import scala.concurrent.Future | |
import scala.concurrent.ExecutionContext.Implicits.global | |
import scala.concurrent.duration._ | |
import akka.util.Timeout |
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.util.List; | |
import java.util.ArrayList; | |
import java.util.stream.Stream; | |
public class StreamTest { | |
public static void main(String[] args) { | |
List<Integer> list = new ArrayList<Integer>(); | |
list.add(1); | |
list.add(2); | |
list.add(3); |
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
package sample.cluster.simple | |
import com.typesafe.config.ConfigFactory | |
import akka.actor.ActorSystem | |
import akka.actor.Props | |
import akka.actor._ | |
import akka.contrib.pattern.ClusterSingletonManager | |
import akka.contrib.pattern.ClusterSingletonProxy | |
class MyClusterActor extends Actor { |
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 test = testcollections.testcoll | |
test: com.mongodb.casbah.MongoCollection = testtest | |
scala> import com.mongodb.casbah.Imports._ | |
import com.mongodb.casbah.Imports._ | |
scala> test.save(MongoDBObject("list" -> List("one", "two", "three"))) // save a list to mongodb | |
res1: com.mongodb.WriteResult = N/A | |
scala> val o = test.findOne.get // get back the thing we just saved |
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
// This is the query to find all of a user's | |
// non-academy courses. In other words... | |
// I want to list all of this user's courses, | |
// but exclude courses associated with | |
// academies in which this user is a member. | |
val user:User = ... | |
val excludeTheseAcademies = (for { | |
au <- AcadUser if au.userId === user.id |
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 scala.concurrent._ | |
import scala.util.{ Success, Failure } | |
import ExecutionContext.Implicits.global | |
import scala.concurrent.duration._ | |
trait Calculator { | |
def hardToCalculate1: Int | |
def hardToCalculate2: Int | |
def hardToCalculate3: Int |
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
package at.atsoft.util | |
import com.ning.http.client.RequestBuilder | |
import com.ning.http.client.Request | |
import com.ning.http.client.FluentCaseInsensitiveStringsMap | |
import java.util.ArrayList | |
import com.ning.http.client.Cookie | |
import java.io.InputStream | |
import com.ning.http.client.Request.EntityWriter | |
import com.ning.http.client.BodyGenerator |
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> import util.Random | |
import util.Random | |
scala> (1 to 1000) map (i => (new Random(i)).nextInt(2)) | |
res25: scala.collection.immutable.IndexedSeq[Int] = Vector(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ... | |
scala> (1 to 1000) map (i => (new Random(i)).nextInt(4)) | |
res26: scala.collection.immutable.IndexedSeq[Int] = Vector |
NewerOlder