Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Maxim Novak maximn

🎯
Focusing
View GitHub Profile
@maximn
maximn / BitMaskExtensions.scala
Created Nov 10, 2015
Bit array string representation of a Scala BitSet
View BitMaskExtensions.scala
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 Feb 22, 2018
Scala preconditions
View assert
val rnd = Math.random()
val n = Math.abs(rnd)
assert(n > 0)
@maximn
maximn / java-adapter-general.java
Last active Nov 26, 2020
Scala adapter pattern - maxondev.com
View java-adapter-general.java
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
A patch for ExtJS 4.2 Ext.tip.ToolTip It hides empty tooltips (the default behavior is to show empty border)
View extjs-tooltip-hideEmpty.js
tips: {
// ...
renderer: function (storeItem, item) {
if (/* want to hide condition ... */) {
this.update();
return;
}
// ... the code for regualr tips we want to show
},
listeners: