Skip to content

Instantly share code, notes, and snippets.

Stephen Judkins stephenjudkins

Block or report user

Report or block stephenjudkins

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
@stephenjudkins
stephenjudkins / .bazelrc
Last active Nov 7, 2019
bazel-managed JDK
View .bazelrc
build --javabase=//:jdk
build --host_javabase=//:jdk
build --java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8
build --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8
View keybase.md

Keybase proof

I hereby claim:

  • I am stephenjudkins on github.
  • I am stephenjudkins (https://keybase.io/stephenjudkins) on keybase.
  • I have a public key whose fingerprint is 22EE 3CFF 0422 A3BC 7AB6 C844 8C82 B078 346A A229

To claim this, I am signing this object:

View gist:3b88e482af895283d0d9
sealed trait Interact[A]
case class Ask(prompt: String)
extends Interact[String]
case class Tell(msg: String)
extends Interact[Unit]
trait Monad[M[_]] {
def pure[A](a: A): M[A]
@stephenjudkins
stephenjudkins / gist:801de2af854245e9f14f
Created May 20, 2014
Hacky fix to IE11 multiple adjacent text nodes problem for Angular
View gist:801de2af854245e9f14f
isText = (node) -> node && node.nodeType == Node.TEXT_NODE
normalizeNode = (node) ->
lastSibling = null
for child in (node?.childNodes || [])
if isText(child) and isText(lastSibling)
combined = lastSibling.nodeValue + child.nodeValue
child.nodeValue = combined
node.removeChild(lastSibling)
View gist:6284917
trait HListContains[-H <: HList, A] { def apply(h: H):A }
implicit def headContains[A, T <: HList] = new HListContains[A :: T, A] {
def apply(h: A :: T) = h.head
}
implicit def tailContains[A, H, T <: HList](implicit tc: HListContains[T, A]) = new HListContains[H :: T, A] {
def apply(h: H :: T) = tc(h.tail)
}
View gist:5769980
<stephenjudkins> luft: SBT can do anything, it's turing-complete
<stephenjudkins> there are examples of SBT tasks that generate scala source code
<dobblego> sbt is turing-complete? what does this mean?
<mapreduce> It can use an infinite amount of tape.
<stephenjudkins> luft: see https://github.com/twitter/sbt-scrooge
<dobblego> what does it mean specifically for sbt to be turing-complete?
<stephenjudkins> dobblego: use your imagination, and don't pick fights
<dobblego> jesus christ you are sook
<dobblego> it's a fucking question
<dobblego> can you tell me what it means please?
View gist:4496805
trait Imp[T] {}
object Imp {
implicit val i = new Imp[Int] {}
}
import Imp._
trait F {
type T
View Sort.scala
object Sort extends App {
//val toCells = (_: String).trim.split(" +")
//val input = io.Source.stdin.getLines.toList.map(toCells).foreach{line => }
val input = List("car", "truck", "8", "4", "bus", "6", "1")
val (matches, mismatches) = input.partition(_.matches("""\d+"""))
}
View gist:4230122
scala> @annotation.implicitNotFound("whoa there! ${A} is not ${B}, buddy") trait Equals[A,B]
defined trait Equals
scala> implicit def equals[A,B](implicit e: A =:= B):Equals[A,B] = null
equals: [A, B](implicit e: =:=[A,B])Equals[A,B]
scala> implicitly[Equals[String, Int]]
<console>:16: error: whoa there! String is not Int, buddy
implicitly[Equals[String, Int]]
^
View gist:4230082
scala> @annotation.implicitNotFound("oh no! could not find Foo with ${A} ${B}") trait Foo[A,B]
defined trait Foo
scala> implicitly[Foo[String, Int]]
<console>:12: error: oh no! could not find Foo with String Int
implicitly[Foo[String, Int]]
You can’t perform that action at this time.