Skip to content

Instantly share code, notes, and snippets.


Roland Yeghiazaryan androideveloper

View GitHub Profile
androideveloper / okhttp-silent-retry.kt
Last active Apr 19, 2019
Okhttp silent retry when idempotent request fails on reused connection
View okhttp-silent-retry.kt
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.logging.HttpLoggingInterceptor
import okhttp3.mockwebserver.MockResponse
import okhttp3.mockwebserver.MockWebServer
import okhttp3.mockwebserver.SocketPolicy
import org.junit.Assert.assertThat
import kotlin.test.assertEquals
fun main() {
androideveloper / pre-commit
Last active Apr 14, 2019
Git hook to enforce branch naming policy
View pre-commit
#!/usr/bin/env bash
local_branch="$(git rev-parse --abbrev-ref HEAD)"
message="There is something wrong with your branch name. Branch names in this project must adhere to this contract: $valid_branch_regex. Your commit will be rejected. You should rename your branch to a valid name and try again."
if [[ ! $local_branch =~ $valid_branch_regex ]]