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 script; | |
import com.amazonaws.services.sqs.AmazonSQS; | |
import com.amazonaws.services.sqs.AmazonSQSClientBuilder; | |
import com.amazonaws.services.sqs.model.Message; | |
import com.amazonaws.services.sqs.model.ReceiveMessageRequest; | |
import com.amazonaws.services.sqs.model.SendMessageBatchRequestEntry; | |
import java.util.List; | |
import java.util.UUID; |
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.concurrent._ | |
import scala.concurrent.duration.Duration | |
import scala.concurrent.{Await, ExecutionContext, Future} | |
object FixedThreadPool { | |
def apply(nThreads: Int, name: String, daemon: Boolean = true): ThreadPoolExecutor = | |
new ThreadPoolExecutor(nThreads,nThreads,0L,TimeUnit.MILLISECONDS,new SynchronousQueue[Runnable],new NamedThreadFactory(name, daemon)) | |
} |
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
// Fun with scala.Dynamic http://www.scala-lang.org/api/current/index.html#scala.Dynamic | |
case object MacBeth extends Dynamic { | |
def applyDynamic(method: String)(args: Any *) = { | |
println(s"$method") | |
MacBeth | |
} | |
} | |
MacBeth itIsATale() toldByAnIdiot() fullOfSoundAndFury() signifyingNothing() |
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
implicit class RicherConditional[T](ifTrue: => T ) { | |
def unless(condition: Boolean) = new WhenOrOtherwise(!condition, ifTrue) | |
def when(condition: Boolean) = new WhenOrOtherwise(condition, ifTrue) | |
} | |
class WhenOrOtherwise[T] (condition: Boolean, ifTrue: => T) { | |
def otherwise(ifOtherwise: => T) = if(condition) ifTrue else ifOtherwise | |
def otherwiseNone = if(condition) Some(ifTrue) else None | |
} |