Skip to content

Instantly share code, notes, and snippets.

View ConnorDoyle's full-sized avatar
💫

Connor Doyle ConnorDoyle

💫
View GitHub Profile
$ g8 EnMAS/pomdp
$ java -jar <path-to-jar>
resolvers += "Sonatype OSS" at "https://oss.sonatype.org/content/groups/public/"
libraryDependencies += "org.enmas" %% "enmas-core" % "1.0.0"
<repository>
<id>sonatype-oss-public</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
</repository>
<dependency>
<groupId>org.enmas</groupId>
@ConnorDoyle
ConnorDoyle / ReflectionHelpersSnippet.scala
Last active January 26, 2022 20:00
Generic reflective case class instantiation with Scala 2.10.x
package test
import scala.reflect.runtime.universe._
object ReflectionHelpers extends ReflectionHelpers
trait ReflectionHelpers {
protected val classLoaderMirror = runtimeMirror(getClass.getClassLoader)
@ConnorDoyle
ConnorDoyle / collapse.scala
Created November 27, 2013 13:47
"Collapse" runs of some target item in a sequence.
def collapse(s: String, target: Char): String = collapse(s.toSeq, target).mkString
def collapse[T](s: Seq[T], target: T): Seq[T] = s match {
case Seq() => Seq[T]()
case t0 +: t1 +: tail if t0 == target && t1 == target =>
collapse(target +: tail, target)
case t +: tail => t +: collapse(tail, target)
}
/*
@ConnorDoyle
ConnorDoyle / BoundedEventBuffer.scala
Last active January 3, 2016 23:09
A thread-safe, bounded, mutable message buffer in Scala.
// implementation...
import scala.collection.mutable.{ ArrayBuffer, ObservableBuffer, Undoable }
import scala.collection.script.{ Message, Include }
import java.io.Closeable
import java.util.concurrent.LinkedBlockingQueue
/**
* A thread-safe, bounded, mutable event buffer.
*/
@ConnorDoyle
ConnorDoyle / Versioned.scala
Last active August 29, 2015 13:56
Versioned
// Versioned
import scala.math.{ Ordered, Ordering }
import scala.collection.{ SortedSet, SortedSetLike }
trait Versioned[V <: Ordered[V]] {
val version: V
}
object Versioned {
@ConnorDoyle
ConnorDoyle / .bash_profile
Created March 6, 2014 17:56
Git Branch - Bash Profile
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
yellow=$(tput setaf 3)
green=$(tput setaf 2)
cyan=$(tput setaf 6)
purple=$(tput setaf 5)
bold=$(tput bold)
reset=$(tput sgr0)
@ConnorDoyle
ConnorDoyle / svcnet-session.sh
Created May 27, 2014 21:46
ServiceNet Session
$ http DELETE localhost:9000/doc
HTTP/1.1 200 OK
Content-Length: 2
Server: Jetty(8.1.13.v20130916)
OK
$ http GET localhost:9000/doc
HTTP/1.1 200 OK
Content-Length: 52