Skip to content

Instantly share code, notes, and snippets.

View maximn's full-sized avatar

Maxim Novak maximn

View GitHub Profile
@maximn
maximn / BitMaskExtensions.scala
Created November 10, 2015 09:14
Bit array string representation of a Scala BitSet
implicit class BitMaskExtensions(bitSet: BitSet) {
def toBitArrayString: String = {
val seq = (0 to bitSet.max) map { x => if (bitSet.contains(x)) "1" else "0"}
"[" + seq.mkString(",") + "]"
}
}
@maximn
maximn / assert
Last active February 22, 2018 20:53
Scala preconditions
val rnd = Math.random()
val n = Math.abs(rnd)
assert(n > 0)
@maximn
maximn / java-adapter-general.java
Last active November 26, 2020 23:32
Scala adapter pattern - maxondev.com
public interface Adaptee {
void doAdaptee();
}
public interface Adaptor {
void doAdaptor();
}
class Client{
private final Adaptor adaptor;
@maximn
maximn / extjs-tooltip-hideEmpty.js
Created May 19, 2013 08:27
A patch for ExtJS 4.2 Ext.tip.ToolTip It hides empty tooltips (the default behavior is to show empty border)
tips: {
// ...
renderer: function (storeItem, item) {
if (/* want to hide condition ... */) {
this.update();
return;
}
// ... the code for regualr tips we want to show
},
listeners: