Skip to content

Instantly share code, notes, and snippets.

View wsargent's full-sized avatar

Will Sargent wsargent

View GitHub Profile
@wsargent
wsargent / gist:5860224
Created June 25, 2013 16:58
Using ning async http client
import play.api.libs.ws.Response
import scala.concurrent.{Future, Promise}
import com.ning.http.client._
import com.ning.http.client.{Response => AHCResponse}
import com.ning.http.client.AsyncCompletionHandler
val url = "http://google.com"
val config = new AsyncHttpClientConfig.Builder()
import play.api.libs.ws.ahc.AhcWSClient
import akka.stream.ActorMaterializer
import akka.actor.ActorSystem
implicit val system = ActorSystem()
implicit val materializer = ActorMaterializer()
val ws = AhcWSClient()
val req = ws.url("http://example.com").get().map{
resp => resp.body
// a Train "at" time produces a TrainFromOps
// a TrainFromOps "from" station produces a Train
// a TrainInfo "at" time produces a TrainInfoFromOps
// a TrainInfoFromOps "from" station produces a TrainInfoAtOps
// a TrainInfoAtOps "at" time produces a TrainFromOps
// TrainOps(train)
// TrainInfoOps(info: TrainInfo)
// TrainFromOps(info, scheudle, time)
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.util.Timeout;
import scala.compat.java8.FutureConverters;
import scala.concurrent.Future;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.TimeUnit;
public class JavaActorLookup {
@wsargent
wsargent / README.md
Created September 8, 2016 00:37 — forked from loicknuchel/README.md
Missing features in Play i18n
@wsargent
wsargent / worktree.sh
Created October 5, 2016 15:27
Git worktree script
export WORKDIR=$HOME/work
# Creates a working tree to check out a branch locally.
# This is useful when you have multiple branches on origin,
# and want to pull work work with them
function worktree() {
# We assume we're always under $WORKDIR somewhere.
# Go down the tree until we know what project we're in.
while [[ "$(dirname "$PWD")" != $WORKDIR ]] ; do
find "$PWD"/ -maxdepth 1 "$@"
package backend
import akka.actor.{Actor, ActorRef, Cancellable}
import scala.concurrent.duration.FiniteDuration
import scala.util.control.NoStackTrace
private case class SchedulerException(msg: String) extends akka.AkkaException(msg) with NoStackTrace
/**
# Usage: gh-clone lagom lagom to checkout lagom/lagom
function gh-clone() {
OWNERNAME=$1;
PROJNAME=$2;
cd $WORKDIR;
mkdir $PROJNAME;
cd $PROJNAME;
hub init -g
hub clone $OWNERNAME/$PROJNAME master;
cd master;
export DEFAULT_USER=wsargent
source $HOME/.antigen/antigen.zsh
# Load the oh-my-zsh's library.
antigen use oh-my-zsh
# Bundles from the default repo (robbyrussell's oh-my-zsh).
antigen bundle git
antigen bundle pip
[error] com.typesafe.play#sbt-plugin;2.6.0-SNAPSHOT!sbt-plugin.jar origin location must be absolute: C:\Users\wsargent\.ivy2\local\com.typesafe.play\sbt-plugin\scala_2.10\sbt_0.13\2.6.0-SNAPSHOT\jars\sbt-plugin.jar
java.lang.IllegalArgumentException: com.typesafe.play#sbt-plugin;2.6.0-SNAPSHOT!sbt-plugin.jar origin location must be absolute: C:\Users\wsargent\.ivy2\local\com.typesafe.play\sbt-plugin\scala_2.10\sbt_0.13\2.6.0-SNAPSHOT\jars\sbt-plugin.jar
at org.apache.ivy.util.Checks.checkAbsolute(Checks.java:57)
at org.apache.ivy.core.cache.DefaultRepositoryCacheManager.getArchiveFileInCache(DefaultRepositoryCacheManager.java:387)
at org.apache.ivy.core.cache.DefaultRepositoryCacheManager.download(DefaultRepositoryCacheManager.java:851)
at org.apache.ivy.plugins.resolver.BasicResolver.download(BasicResolver.java:835)
at org.apache.ivy.plugins.resolver.RepositoryResolver.download(RepositoryResolver.java:282)
at org.apache.ivy.core.resolve.ResolveEngine.downloadAr