Skip to content

Instantly share code, notes, and snippets.

@havocp
havocp / gist:7048451
Last active Dec 25, 2015
Type safety in real life
View gist:7048451

My mom is building a house. The builder sent her an invoice spreadsheet, which was simply a bunch of items summed up:

  $5000.00
   $100.00
  $1300.00
   ... etc.

GRAND TOTAL $WHATEVER
@havocp
havocp / RipMusic.sh
Created Mar 3, 2013
My hacky rip script
View RipMusic.sh
#!/bin/bash
set -e
function die() {
echo "$*" 1>&2
exit 1
}
SKIP_RIP=0
@havocp
havocp / gist:2177fc9fc3aaa03860b6
Created Nov 12, 2015
2015-11-12 8am output of bokeh coffee/python comparison test
View gist:2177fc9fc3aaa03860b6
AjaxDataSource: coffee is missing some properties found in Python
AjaxDataSource.callback: python defaults to null but coffee has no such property
AjaxDataSource.column_names: python defaults to [] but coffee has no such property
AjaxDataSource.data_url: python defaults to null but coffee has no such property
AjaxDataSource.if_modified: python defaults to false but coffee has no such property
AjaxDataSource.max_size: python defaults to null but coffee has no such property
AjaxDataSource.method: python defaults to "POST" but coffee has no such property
AjaxDataSource.name: python defaults to null but coffee has no such property
AjaxDataSource.polling_interval: python defaults to null but coffee has no such property
AjaxDataSource.session: python defaults to null but coffee has no such property
View BatchingExecutionContext.scala
/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2003-2011, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
package scala.concurrent.impl
@havocp
havocp / example-akka-filtering.patch
Created Jun 5, 2012
example of filtering mima issues
View example-akka-filtering.patch
diff --git a/project/AkkaBuild.scala b/project/AkkaBuild.scala
index 23d51fe..a47aa8e 100644
--- a/project/AkkaBuild.scala
+++ b/project/AkkaBuild.scala
@@ -13,6 +13,7 @@ import com.typesafe.sbtscalariform.ScalariformPlugin.ScalariformKeys
import com.typesafe.sbtosgi.OsgiPlugin.{ OsgiKeys, osgiSettings }
import com.typesafe.tools.mima.plugin.MimaPlugin.mimaDefaultSettings
import com.typesafe.tools.mima.plugin.MimaKeys.previousArtifact
+import com.typesafe.tools.mima.plugin.MimaKeys.binaryIssueFilters
import java.lang.Boolean.getBoolean
@havocp
havocp / filter-reported-issues.patch
Created Jun 5, 2012
Patch to support filtering mima issues
View filter-reported-issues.patch
diff --git a/core/src/main/scala/com/typesafe/tools/mima/core/Filters.scala b/core/src/main/scala/com/typesafe/tools/mima/core/Filters.scala
new file mode 100644
index 0000000..fc8b98c
--- /dev/null
+++ b/core/src/main/scala/com/typesafe/tools/mima/core/Filters.scala
@@ -0,0 +1,17 @@
+package com.typesafe.tools.mima.core
+
+object ProblemFilters {
+
View null-actor-instance.patch
diff --git a/akka-actor-tests/src/test/scala/akka/actor/HotSwapSpec.scala b/akka-actor-tests/src/test/scala/akka/actor/HotSwapSpec.scala
index 120caa3..00ef54e 100644
--- a/akka-actor-tests/src/test/scala/akka/actor/HotSwapSpec.scala
+++ b/akka-actor-tests/src/test/scala/akka/actor/HotSwapSpec.scala
@@ -5,6 +5,7 @@
package akka.actor
import akka.testkit._
+import akka.util.duration._
@havocp
havocp / actor-cell-mid-construction.patch
Created May 29, 2012
set the 'actor' field in ActorCell mid-actor-construction rather than post-construction
View actor-cell-mid-construction.patch
diff --git a/akka-actor/src/main/scala/akka/actor/Actor.scala b/akka-actor/src/main/scala/akka/actor/Actor.scala
index f268b8f..2db8956 100644
--- a/akka-actor/src/main/scala/akka/actor/Actor.scala
+++ b/akka-actor/src/main/scala/akka/actor/Actor.scala
@@ -304,6 +304,10 @@ trait Actor {
*/
implicit final val self = context.self //MUST BE A VAL, TRUST ME
+ // this will call back to receive and aroundReceive so do it
+ // only after we set up `context` and `self`
@havocp
havocp / Config.scala
Created May 28, 2012
sketchy config scala wrapper
View Config.scala
package scala.config
import scala.config._
import com.typesafe.{ config => j }
sealed trait ConfigMergeable {
def asJava: j.ConfigMergeable
def withFallback(mergeable: ConfigMergeable): ConfigMergeable
}
@havocp
havocp / actor-mixins-mapbehavior.patch
Created May 18, 2012
Squashed patch with mapBehavior
View actor-mixins-mapbehavior.patch
diff --git a/akka-actor-tests/src/test/java/akka/actor/JavaAPI.java b/akka-actor-tests/src/test/java/akka/actor/JavaAPI.java
index 5125611..25268dd 100644
--- a/akka-actor-tests/src/test/java/akka/actor/JavaAPI.java
+++ b/akka-actor-tests/src/test/java/akka/actor/JavaAPI.java
@@ -8,6 +8,10 @@ import akka.routing.CurrentRoutees;
import akka.routing.FromConfig;
import akka.routing.NoRouter;
import akka.testkit.AkkaSpec;
+import static akka.pattern.Patterns.ask;
+import akka.dispatch.*;