Skip to content

Instantly share code, notes, and snippets.

View mCzolko's full-sized avatar

Michael Czolko mCzolko

View GitHub Profile
@mCzolko
mCzolko / BinaryIntervalSearch.kt
Last active October 20, 2023 23:49
Binary Interval Search
class BinaryIntervalSearch(
private val initialValue: Int,
private val estimationStep: Int,
private val maxValue: Int,
val meetsCondition: () -> Boolean = { true }
) {
fun search(doWork: (newValue: Int) -> Unit): Int {
if (this.maxValue < initialValue) {
throw Error("Max value cant be smaller than initial value")
@mCzolko
mCzolko / OSVC.ts
Created February 19, 2024 10:46
Výpočet daně, socka a zdrávka pro rok 2024 (po reformě)
export class OSVC {
public readonly percentageDiscount = 0.6
constructor(public readonly expectedIncome: number) {}
get totalExpenses(): number {
return this.healthInsurance + this.socialInsurance + this.taxes
}
get netIncome(): number {