Skip to content

Instantly share code, notes, and snippets.

View prondzyn's full-sized avatar
📓
https://ProgramistaNaSwoim.pl

Piotr Prądzyński prondzyn

📓
https://ProgramistaNaSwoim.pl
View GitHub Profile
@prondzyn
prondzyn / JooqTestExample.kt
Last active July 18, 2023 12:54
An example usage of @JooqTest (Spring Boot, Kotlin, kotest, Testcontainers, jOOQ)
import io.kotest.core.spec.style.WordSpec
import io.kotest.extensions.spring.SpringExtension
import io.kotest.matchers.*
import generated.tables.daos.FacilityDao
import generated.jooq.tables.pojos.Facility
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.autoconfigure.jooq.JooqTest
import org.springframework.context.annotation.Import
import org.springframework.test.context.DynamicPropertyRegistry
import org.springframework.test.context.DynamicPropertySource
@prondzyn
prondzyn / HandleImageWithSwaggerAndExceptionHandlerExamplesController.kt
Last active July 3, 2023 06:45
Example of proper handing error response in Spring Boot + Swagger while endpoint is producing "image/jpeg"
// imports are here
@RestController
class ImageController {
// This will work, but response content type can be improper.
@GetMapping("/images_1/{id}")
fun getImage1(@PathVariable id: UUID): ByteArray? {
return // bytes of an image
}
blueprint:
name: ZHA - Moes Smart Knob for lights (prondzyn edit)
description: 'Control lights with a Moes Smart Knob.
You can set functions for a single press. This allows you to assign,
e.g., a scene or anything else.
Rotating left/right will change the brightness smoothly of the selected light.
Not all functionality of the device is available at time of writing, e.g. double press, long press and press and rotate.