Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am jonas on github.
  • I am fonseca (https://keybase.io/fonseca) on keybase.
  • I have a public key ASC_xqi-fdET_IP443BMbMCm38wXPHf4ksVYvh55i19_wAo

To claim this, I am signing this object:

lazy val root = (project in file(".")).dependsOn(sbtPlugins)
lazy val sbtPlugins = file("../sbt-plugins")
@jonas
jonas / CollectionReachabilitySuite.scala
Last active June 9, 2017 13:59
Scala Native CollectionReachabilitySuite
package scala.scalanative.linker
import org.scalatest._
import scalanative.nir.Global
class CollectionReachabilitySuite extends ReachabilitySuite {
val sources = Seq("""
trait Collection[E] {
def isEmpty: Boolean
def size: Int
@jonas
jonas / Test.scala
Last active April 17, 2017 20:36
Scala Native bindgen WIP
import scalanative.native._, stdlib._, stdio._, string._
import scalanative.runtime.bindgen._
object Test {
import Bindgen._
sealed trait Node
case class Function(name: String, returnType: String, args: List[Function.Arg]) extends Node
object Function {
case class Arg(name: String, tpe: String)
jQuery(document).ready(function ($) {
initOldVersionWarnings($);
});
function initOldVersionWarnings($) {
$.get("//akka.io/versions.json", function (akkaVersionsData) {
var site = splitPath();
console.log(site);
if (site.v === 'snapshot') {
console.log("Detected SNAPSHOT Akka version...");
@jonas
jonas / JavaInitializerSpec.patch
Created March 7, 2017 15:15
JavaInitializerSpec
diff --git i/akka-http-core/src/test/scala/akka/http/javadsl/JavaInitializationSpec.scala w/akka-http-core/src/test/scala/akka/http/javadsl/JavaInitializationSpec.scala
index da49fcdfaf..9107486305 100644
--- i/akka-http-core/src/test/scala/akka/http/javadsl/JavaInitializationSpec.scala
+++ w/akka-http-core/src/test/scala/akka/http/javadsl/JavaInitializationSpec.scala
@@ -8,12 +8,21 @@ import org.scalatest.{ Matchers, WordSpec }
class JavaInitializationSpec extends WordSpec with Matchers {
+ implicit class HeaderCheck[T](self: T) {
+ def =!=(expected: String) = self.toString shouldBe expected
"HAPROXY_0_BACKEND_HEAD": "backend {backend}\n balance roundrobin\n mode {mode}\n rspadd Access-Control-Allow-Origin:\\ *\n rspadd Access-Control-Allow-Methods:\\ GET,\\ POST,\\ PUT,\\ OPTIONS,\\ DELETE\n rspadd Access-Control-Allow-Headers:\\ Origin,\\ X-Requested-With,\\ Content-Type,\\ Accept,\\ Authorization\n"
@jonas
jonas / StringConcatenationBenchmark.scala
Created January 2, 2017 19:08
Scala string concatenation benchmark
import java.util.concurrent.TimeUnit
import org.openjdk.jmh.annotations._
/**
* The following command will run the benchmarks with reasonable settings:
*
* > sbt "benchmark/jmh:run -i 10 -wi 10 -f 2 -t 1 StringConcatenationBenchmark"
*/
@State(Scope.Thread)
@BenchmarkMode(Array(Mode.Throughput))
@jonas
jonas / build.sbt
Last active November 29, 2016 02:49
JSON templating with Typesafe Config
lazy val deployProd = taskKey[Unit]("Deploy a job to prod")
lazy val deployQA = taskKey[Unit]("Deploy a job to qa")
lazy val jobConfig = settingKey[Config]("Job configuration")
// Environments endpoints are defined via Credentials where realm contains the env name.
val qa = Credentials(...)
val prod = Credentials(...)
// Task to fetch an existing JSON document, generate a new configuration
// using per-job overrides and then use the result to deploy a job.
@jonas
jonas / .gitconfig
Last active October 21, 2016 00:00
[alias]
prune-remotes = "!f() { for r in $(git remote); do git remote prune $r; done; }; f"
#prune-branches = "!f() { git prune-remotes; git branch --merged | sed -n 's/.*\\(version\\|bugfix\\|feature\\|jonas\\)/\\1/p' | xargs -n 1 git branch -d $b; }; f"
prune-branches = "!f() { git prune-remotes; git branch --merged | sed -n 's/[ *]*\\([a-z].*\\)/\\1/p' | grep -v master | xargs -n 1 git branch -d ; }; f"