Skip to content

Instantly share code, notes, and snippets.

View jeantil's full-sized avatar
✔️

Jean Helou jeantil

✔️
View GitHub Profile
@jeantil
jeantil / crash.scala
Created February 20, 2015 08:51
Crash scala console
import scala.concurrent._
import scala.concurrent.ExecutionContext.Implicits.global
import scala.util.Random
val range = (1 to 10).toList
val delays = range.map(_=>Random.nextInt(1000))
val rangeDelays = range zip delays
val a = rangeDelays.map {
case(i,d) => Future {
Thread.sleep(d)
@jeantil
jeantil / LICENSE
Last active August 29, 2015 14:13
RoundRobinActorPool
The MIT License (MIT)
Copyright (c) 2014 Jean Helou
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@jeantil
jeantil / RoundRobinFixedSizeActorPool.scala
Created January 20, 2015 13:33
RoundRobinFixedSizeActorPool
package actors.browser
import akka.actor.{Terminated, Props, ActorLogging, Actor}
import akka.routing._
import scala.collection.immutable.IndexedSeq
class RoundRobinFixedSizeActorPool(props:Props, nbActors:Int) extends Actor with ActorLogging{
val resizer = DefaultResizer(nbActors, nbActors)
val routingLogic = RoundRobinRoutingLogic()
@jeantil
jeantil / gist:16f66a0115777cf1b0e7
Created January 8, 2015 17:14
sbt plugins dependency hell :(
"com.jsuereth" % "sbt-pgp" % "1.0.0"
|-> depends on "net.databinder" %% "dispatch-http" % "0.8.10"
|-> depends on "org.apache.httpcomponents" % "httpclient" % "4.1.3"
"de.heikoseeberger" % "sbt-groll" % "4.4.0"
|-> depends on "org.eclipse.jgit" % "org.eclipse.jgit" % "3.5.3.201412180710-r"
|-> depends on "org.apache.httpcomponents" % "httpclient" % "4.1.3"
"ohnosequences" % "sbt-s3-resolver" % "0.8.0" -> "0.12.0"
|-> depends on "com.amazonaws" % "aws-java-sdk" % "1.6.1" -> "1.7.13"
package libs.mvc
import java.util.UUID
import play.api.libs.json.Json
import play.api.mvc._
import play.api.libs.concurrent.Execution.Implicits.defaultContext
import play.api.Logger
import org.joda.time.DateTime
@jeantil
jeantil / gist:e635f3bc34f1dd5f2708
Created July 2, 2014 09:37
Google experiments
googleplay-support@google.com
11:20 AM (16 minutes ago)
to me
Hello Jean,
Thank you for contacting Google. I understand you are having difficulties transferring "Implementing Domain-Driven Design" to your Kobo due to an error message you are receiving. I apologize for the disruption this has caused in your reading experience.
We have noted that some users experience device limit errors when using multiple devices or reset their device firmware. I've asked our technical specialists to remove this limit, and you should be able to access your book through your device within a day or so.
@jeantil
jeantil / HazelcastMongoStore.scala
Last active August 29, 2015 14:02
Hazelcast mongo store based on Play-ReactiveMongo
package libs
import java.io.{ObjectInputStream, ByteArrayInputStream, ObjectOutputStream, ByteArrayOutputStream}
import java.util
import scala.concurrent.{Await}
import play.api.libs.iteratee.Enumerator
import play.modules.reactivemongo.ReactiveMongoPlugin
@jeantil
jeantil / keybase.md
Last active August 29, 2015 14:02
keybase.md

Keybase proof

I hereby claim:

  • I am jeantil on github.
  • I am jeantil (https://keybase.io/jeantil) on keybase.
  • I have a public key whose fingerprint is 3350 5E9B D3AD 49B2 A0C3 F638 98EE BAAA A074 A594

To claim this, I am signing this object:

package helpers
object Generators {
private val epoch = new DateTime(0)
val nameGen = for {
head <- Gen.alphaUpperChar
size<- Gen.choose(1,10)
tail <- Gen.listOfN(size,Gen.alphaLowerChar)
} yield (head +: tail).mkString("")
}
@jeantil
jeantil / GoogleLoginSpec.scala
Last active August 29, 2015 14:02
Google OAuth flow in SecureSocial 3Alpha
package scenarios
import org.specs2.mutable.Specification
import org.specs2.mock.Mockito
import play.api.test.{FakeApplication, PlaySpecification, WithApplication}
import scenarios.helpers.{TestGlobal, DemoUser, TestUserService}
import securesocial.core.providers.GoogleProvider
import securesocial.core.{EventListener, RuntimeEnvironment}
import securesocial.core.services.{HttpService, UserService, RoutesService}