Skip to content

Instantly share code, notes, and snippets.

[alias]
cherry-grab = "!f() { \
git rev-list $1^2 ^$1^1 | tac | xargs git cherry-pick; \
}; f"
fun EditText.debounce(delay: Long, action: (Editable?) -> Unit) {
doAfterTextChanged { text ->
var counter = getTag(id) as? Int ?: 0
handler.removeCallbacksAndMessages(counter)
handler.postDelayed(delay, ++counter) { action(text) }
setTag(id, counter)
}
}