Skip to content

Instantly share code, notes, and snippets.

@jiffle
jiffle / git-tricks.md
Created August 26, 2018 11:07
Git History Rewriting Tricks

Git History Rewriting Tricks

Removing incorrectly committed files from the last commit

This uses a Soft Reset to revert the commit, leaving the commit modifications as local working copy changes:

git reset --soft HEAD^ or git reset --soft HEAD~1

@jiffle
jiffle / strikt-cheatsheet.md
Last active March 2, 2023 15:44
Strikt Cheatsheet

Tricks and tips for using Strikt assertions

Strikt is very powerful, however it is sometimes hard to find particular methods. This is a handy cheatsheet.

Basics

Top-level assertions

expect, expectThat, expectCatching and expectThrows

@jiffle
jiffle / refactorsafe-enum-kotlin.kts
Created September 9, 2021 08:09
Refactor-Safe Enum Pattern in Kotlin
import com.fasterxml.jackson.annotation.JsonValue
enum class AccountStatus(@JsonValue val text: String) {
PENDING("Pending"),
ACTIVE("Active"),
EXPIRED("Expired"),
CANCELLED("Cancelled");
companion object {
private val valuesByText = values().associateBy { it.text }
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.