Skip to content

Instantly share code, notes, and snippets.

Christopher Hunt huntc

Block or report user

Report or block huntc

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View SourceInputStream.scala
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.contrib.stream
import akka.actor.{ ActorRef, ActorRefFactory, FSM, Props }
import akka.pattern.ask
import akka.stream.actor.ActorSubscriberMessage.{ OnComplete, OnError, OnNext }
import akka.stream.actor.{ ActorSubscriber, RequestStrategy, ZeroRequestStrategy }
@huntc
huntc / bundleRequest.scala
Last active Aug 29, 2015
Initial attempt at marshalling a bundle request given multipart formdata
View bundleRequest.scala
package com.typesafe.reactiveruntime.net
import akka.actor.{ActorRef, Actor}
import akka.http.Unmarshal
import akka.http.model.HttpMethods._
import akka.http.model.{ HttpEntity, HttpRequest, HttpResponse, MultipartFormData, StatusCodes }
import akka.http.unmarshalling.Unmarshalling
import akka.pattern.ask
import akka.stream.scaladsl.{ ImplicitFlowMaterializer, Flow }
import akka.util.{ Timeout, ByteString }
View gist:46927a54d4211fd521ba
package com.typesafe.reactiveruntime.resource
import akka.actor.{ActorRef, Props, Actor}
import akka.cluster.ClusterEvent.{MemberEvent, InitialStateAsEvents, MemberRemoved, MemberUp}
import akka.cluster.{Member, Cluster, UniqueAddress}
import akka.contrib.pattern.{DistributedPubSubMediator, DistributedPubSubExtension}
import com.typesafe.reactiveruntime.resource.ResourceProvider.Event.ResourceOffer
import com.typesafe.reactiveruntime.resource.ResourceProvider.RequestResources
import java.util.UUID
import scala.collection.immutable.HashSet
View gist:838e75a7f9870cb7ff76
case class StartBundle(bundleName: String, bundleSource: ActorRef, configName: String, configSource: Option[ActorRef])
View gist:e4f89679303e89d7a356
package com.typesafe.sbt.rr
import sbt._
import Keys._
import complete.DefaultParsers._
import com.typesafe.sbt.SbtNativePackager._
import NativePackagerKeys._
import sbt.complete.Parser
object Import {
@huntc
huntc / gist:b0279d79fcb706e0e1e0
Last active Aug 29, 2015
Prototype stream buffer
View gist:b0279d79fcb706e0e1e0
package com.typesafe.jse
import java.io.{IOException, OutputStream, InputStream}
import java.util.concurrent.locks.{Lock, ReentrantLock}
import java.util.concurrent.TimeUnit
import scala.concurrent.duration._
/**
* Maintains a circular buffer where an output stream is used to push data into it, and an input stream is used to
* pull data from it. The caller is expected to *always* close the input and output streams.
View gist:9822808
(function(sbt) {
var playScala = require("playScala");
var playKeys = playScala.keys;
return sbt.project.in(sbt.cwd)
.addPlugins(playScala);
.addSettings({
"name": "test-jshint",
"version": "1.0-SNAPSHOT",
@huntc
huntc / gist:8911360
Last active Aug 29, 2015
Minimising plugin code for sbt
View gist:8911360
object JSHintPlugin extends NodeJsPlugin {
object JshintKeys {
val jshint = TaskKey[Unit]("jshint", "Perform JavaScript linting.")
val jshintOptions = TaskKey[String]("jshint-options", "An array of jshint options to pass to the linter. This options are found via jshint-resolved-config. If there is no config then the options will be specified such that the JSHint defaults are used.")
val config = SettingKey[Option[File]]("jshint-config", "The location of a JSHint configuration file.")
val resolvedConfig = TaskKey[Option[File]]("jshint-resolved-config", "The actual location of a JSHint configuration file if present. If jshint-config is none then the task will seek a .jshintrc in the project folder. If that's not found then .jshintrc will be searched for in the user's home folder. This behaviour is consistent with other JSHint tooling.")
@huntc
huntc / main.scala
Created Feb 5, 2014
Illustrates how a single Itinerary or an array of Itinerary objects can be rendered as a List[Itinerary]
View main.scala
package controllers
import play.api._
import play.api.mvc._
import play.api.libs.json._
case class Itinerary(name: String)
object Itinerary {
implicit val format = Json.format[Itinerary]
@huntc
huntc / a.js
Last active Jan 2, 2016
Shows how NODE_PATH, amdefine and Node can be used together to run things with multiple context paths.
View a.js
/*global define */
// This file for the target/public folder
define(function() {
return 1;
});
You can’t perform that action at this time.