Skip to content

Instantly share code, notes, and snippets.

caoilTe O'Connor caoilte

Block or report user

Report or block caoilte

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
@caoilte
caoilte / ExampleEncoderTest.scala
Last active May 18, 2017
unit testing HTTP4s encoders
View ExampleEncoderTest.scala
package httpServices
import io.circe.{Encoder, Printer}
import org.http4s.circe.CirceInstances
import org.scalatest.{FlatSpec, Matchers}
import org.http4s.dsl._
class GistTest extends FlatSpec with Matchers {
case class TestObject(someValue: Int, someOptionalValue:Option[Int])
@caoilte
caoilte / ExampleEncoderTest.scala
Created May 18, 2017
unit testing HTTP4s encoders
View ExampleEncoderTest.scala
package httpServices
import io.circe.Printer
import org.http4s.circe.CirceInstances
import org.scalatest.{FlatSpec, Matchers}
import io.circe.generic.auto._
import org.http4s.dsl._
class ExampleEncoderTest extends FlatSpec with Matchers {
View example-bruce.json
{
"_embedded": {
"promotions": [{
"type": "url",
"contentfulName": "15 minute container",
"position": "primary",
"title": "Mark's First URL Promo",
"subtitle": "It's the first one I tell ya",
"_links": {
@caoilte
caoilte / QueueExample.scala
Last active Jun 13, 2016
scalaz-stream example of problem for Stack Overflow question
View QueueExample.scala
import java.util.concurrent.Executors
import scalaz.concurrent.{Strategy, Task}
import scalaz.stream._
import scalaz.stream.async.mutable.Queue
object Processes {
val source: Process[Task, String] = Process.emitAll(0 until 10).map(_.toString())
val slowProcessor1: Channel[Task, String, String] =
@caoilte
caoilte / InfiniteBatchProcessor.scala
Created Jun 10, 2016
Infinite Batch Processing Walking Skeleton using scalaz-stream
View InfiniteBatchProcessor.scala
import java.util.concurrent.Executors
import scalaz.concurrent.{Strategy, Task}
import scalaz.stream._
import scalaz.stream.async.mutable.Queue
object MercuryPlayabilityUpdater {
implicit val DefaultStrategy: Strategy = Strategy.Executor(
Executors.newFixedThreadPool(10, Strategy.DefaultDaemonThreadFactory)
@caoilte
caoilte / latest_rpm_release_in_artifactory.sh
Created Mar 5, 2016
How to get the latest version of an RPM from an Artifactory Repository
View latest_rpm_release_in_artifactory.sh
echo 'items.find(
{
"repo":{"$eq":"<REPO_NAME>"},
"name":{"$match":"<RPM_NAME>*"}
}
).include("name", "@rpm.metadata.release").sort({"$desc" : ["name"]}).limit(1)' > aql.json
curl -X POST -Taql.json --user <USER>:<PASSWORD> "https://<ARTIFACTORY>/api/search/aql" | python -c "import json,sys;obj=json.load(sys.stdin);print obj['results'][0]['properties'][0]['value'];"
View EnsimeTypeAtPoint.scala
//import Foo._
object Foo {
case class /\(name: String)
case class Bar(name: String)
}
object Test {
@caoilte
caoilte / jaxb-in-scala-2_01.scala
Last active Aug 29, 2015
Bending JAXB to the will of Scala [2/2]
View jaxb-in-scala-2_01.scala
import scala.annotation.target.field
import javax.xml.bind.annotation._
import javax.xml.bind.annotation.adapters._
type xmlElement = XmlElement @field
type xmlTypeAdapter = XmlJavaTypeAdapter @field
/**
* NB As with the CustomOptionAdapter we've had to modify the type signature here,
@caoilte
caoilte / jaxb-in-scala-1_01.scala
Last active Aug 29, 2015
Bending JAXB to the will of Scala [1/2]
View jaxb-in-scala-1_01.scala
case class EntryType(entrytypeoption: Seq[scalaxb.DataRecord[Any]] = Nil,
attributes: Map[String, scalaxb.DataRecord[Any]]) extends FeedTypeOption
case class EntryType(entrytypeoption: Seq[scalaxb.DataRecord[Any]] = Nil,
xmlbase: Option[java.net.URI] = None,
xmllang: Option[String] = None,
attributes: Map[String, scalaxb.DataRecord[Any]]) extends FeedTypeOption
You can’t perform that action at this time.