Skip to content

Instantly share code, notes, and snippets.

View kornelijepetak's full-sized avatar

Kornelije Petak kornelijepetak

View GitHub Profile

Write a WPF application that would correctly display the items defined in the ViewModel.

Prerequisite

Create an empty WPF project. Copy-paste the MainViewModel.cs file to the project.

Goal

  • Display items in the TimeEntries list as rectangles with a fixed width (e.g. 100 px). The items should have corresponding color, offset from the top of the container, and height as defined in the ViewModel properties.

Bonus Goal 1

@kornelijepetak
kornelijepetak / effective-color-after-opacity
Created November 11, 2020 12:19
Effective color after applying opacity
function hexToRgb(hex: string) {
const hexRegex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i
return hexRegex.exec(hex).slice(1, 4).map(i => parseInt(i, 16) / 255.0)
}
function componentToHex(c: number) {
var hex = Math.round(c * 255).toString(16)
return hex.length == 2 ? hex : "0" + hex
}
@kornelijepetak
kornelijepetak / keybase.md
Created August 31, 2020 12:57
keybase.md

Keybase proof

I hereby claim:

  • I am kornelijepetak on github.
  • I am kornelijepetak (https://keybase.io/kornelijepetak) on keybase.
  • I have a public key ASB7VGubnJmNbYQUxtfWsvZwLp9zNvqanbItDyglJ9gVpQo

To claim this, I am signing this object: