Skip to content

Instantly share code, notes, and snippets.

View trenthudy's full-sized avatar

Trent Hudepohl trenthudy

View GitHub Profile
@trenthudy
trenthudy / BackgroundWork.java
Last active July 25, 2019 01:03
A simple Android threading solution, that allows work to be lifted from the main thread and delegated to a background thread pool.
package io.hudepohl.custom_thread_sample;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import androidx.annotation.MainThread;
import androidx.annotation.WorkerThread;
import org.jetbrains.annotations.NotNull;
@trenthudy
trenthudy / KotlinEnumClassGsonDeserializationTest.kt
Last active November 17, 2023 20:43
Deserializing Kotlin enum classes with Gson
package io.hudepohl
import com.google.gson.Gson
import com.google.gson.annotations.SerializedName
import com.google.gson.reflect.TypeToken
import org.junit.Assert.assertTrue
import org.junit.Test
private const val testJson =
"""
@trenthudy
trenthudy / Html.kt
Last active September 30, 2021 18:21
package io.hudepohl
import java.lang.StringBuilder
class Html {
private val value: StringBuilder = StringBuilder()
private fun add(text: String) = value.append(text)
override fun toString(): String = value.toString()
/**
* Created by trent on 9/18/17.
*/
public class HelloWorldGist {
/**
* Concatenate a URL and an endpoint.
*
* In some cases, a base URL ends with '/' and an endpoint starts with '/', so