Skip to content

Instantly share code, notes, and snippets.

View mpollmeier's full-sized avatar

Michael Pollmeier mpollmeier

View GitHub Profile
object ValueClassDebug {
class Foo
class FooExtNormalClass(val foo: Foo) {
def bar: Int = 42
}
implicit class FooExtImplicitClass(val foo: Foo) {
def barViaImplicitClass: Int = 42
}
class Foo
implicit class FooExt(val foo: Foo) extends AnyVal {
def bar = 42
}
// usage
val foo = new Foo
foo.bar // will not allocate FooExt
@mpollmeier
mpollmeier / softrefcache.java
Created March 27, 2019 06:22
java soft reference cache
import java.lang.ref.SoftReference;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.concurrent.ConcurrentLinkedDeque;
public class FinalizedTest {
static final int count = 5000000;
/**
* to get usable output, run with e.g. `-Xms1g -Xmx1g -XX:SoftRefLRUPolicyMSPerMB=0`

Keybase proof

I hereby claim:

  • I am mpollmeier on github.
  • I am mpollmeier (https://keybase.io/mpollmeier) on keybase.
  • I have a public key whose fingerprint is EBB5 6E13 9386 4F9B 4747 9E14 E0A0 EE62 B24D 0836

To claim this, I am signing this object:

mvn dependency:tree
[INFO] org.apache.tinkerpop:tinkergraph-gremlin:jar:3.2.5-SNAPSHOT
[INFO] +- org.apache.tinkerpop:gremlin-core:jar:3.2.5-SNAPSHOT:compile
[INFO] | +- org.apache.tinkerpop:gremlin-shaded:jar:3.2.5-SNAPSHOT:compile
[INFO] | +- commons-configuration:commons-configuration:jar:1.10:compile
[INFO] | | \- commons-lang:commons-lang:jar:2.6:compile
[INFO] | +- org.yaml:snakeyaml:jar:1.15:compile
[INFO] | +- org.javatuples:javatuples:jar:1.2:compile
[INFO] | +- com.carrotsearch:hppc:jar:0.7.1:compile
@mpollmeier
mpollmeier / Test.scala
Created October 20, 2015 03:09
shapeless derive mapped type
import shapeless._
import shapeless.poly._
import shapeless.ops.hlist._
import shapeless.UnaryTCConstraint._
object Util {
case class Label[A](name: String, value: A)
object GetLabelName extends (Label ~> Const[String]#λ) {
def apply[A](label: Label[A]) = label.name
@mpollmeier
mpollmeier / converse.min.css
Last active October 17, 2019 21:59
converse.js minimal example
/** Converse.js (Web-based XMPP instant messaging client)
* http://conversejs.org
* Copyright (c) 2012, Jan-Carel Brand <jc@opkode.com>
* Dual licensed under the MIT and GPL Licenses
*/
/*!
* Converse.js (Web-based XMPP instant messaging client)
* http://conversejs.org
*
* Copyright (c) 2012-2014, JC Brand <jc@opkode.com>
@mpollmeier
mpollmeier / gist:108ab8998e3b0321f020
Last active August 29, 2015 14:22
Neo4j with Gremlin-Scala
import org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph
import gremlin.scala._
val dbPath = "/tmp/test" + math.random
val timeStart = System.currentTimeMillis
val graph = Neo4jGraph.open(dbPath)
val sg = ScalaGraph(graph)
val gs = GremlinScala(graph)
// graph.tx.open()