Skip to content

Instantly share code, notes, and snippets.

View bentrengrove's full-sized avatar

Ben Trengrove bentrengrove

View GitHub Profile
@bentrengrove
bentrengrove / submission.patch
Last active July 6, 2026 01:37
android_cli_2
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 59796f9..47ebe56 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -5,14 +5,20 @@ plugins {
}
android {
- namespace = "com.example.comexamplebookfind"
+ namespace = "com.example.bookfind"
@bentrengrove
bentrengrove / submission.patch
Created July 6, 2026 01:35
HelloAndroid_5
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 6342d61..d72473b 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -34,6 +34,11 @@ kotlin {
vectorDrawables {
useSupportLibrary = true
}
+
+ val backendUrlVal = project.findProperty("backendUrl") as? String ?: "https://openlibrary.org/"
@bentrengrove
bentrengrove / submission.patch
Last active July 6, 2026 01:32
HelloAndroid_4
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 6342d61..c3ee792 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -18,6 +18,10 @@ plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.compose.compiler)
}
+
+val backendUrl = project.findProperty("backendUrl") as? String ?: "https://openlibrary.org/"
@bentrengrove
bentrengrove / submission.patch
Created July 6, 2026 01:29
android_cli_1.patch
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 59796f9..77c9f2c 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -4,15 +4,20 @@ plugins {
alias(libs.plugins.kotlin.serialization)
}
+val backendUrl: String = project.findProperty("backendUrl") as? String ?: "https://openlibrary.org/"
+val coversUrl: String = project.findProperty("coversUrl") as? String ?: "https://covers.openlibrary.org/"
@bentrengrove
bentrengrove / MatrixText.kt
Last active December 5, 2024 22:24
MatrixText.kt - A Composeable that displays text Matrix style down the screen
private const val MAX_SPEED = 25
private const val MIN_SPEED = 7
private const val MAX_FONT_SIZE = 64f
private const val MIN_FONT_SIZE = 24f
private val characters = listOf("ジ", "ェ", "ッ", "ト", "パ", "ッ", "ク", "構", "成")
private val colors = listOf(0xffcefbe4, 0xff81ec72, 0xff5cd646, 0xff54d13c, 0xff4ccc32, 0xff43c728)
@Composable
fun MatrixText(
stripCount: Int = 25,
lettersPerStrip: Int = 20,
import androidx.compose.animation.animatedFloat
import androidx.compose.animation.core.AnimationConstants
import androidx.compose.animation.core.LinearEasing
import androidx.compose.animation.core.repeatable
import androidx.compose.animation.core.tween
import androidx.compose.foundation.Canvas
import androidx.compose.material.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.onActive
import androidx.compose.ui.Modifier
@bentrengrove
bentrengrove / Sample.kt
Last active February 12, 2024 12:25
Sample code demonstrating using Kotlin for type safe unit conversion
val miles = 1.kilometers.to(Distance.Mile)
val kilometers = 1.miles.to(Distance.Kilometer)
val total = 2.kilometers + 1.miles + 10.meters + 1.centimeter + 1.millimeter
Log.d("MainActivity", "Total distance is ${total.meters.amount} meters")
val totalTime = 2.hours + 2.minutes + 2.seconds + 2.milliseconds
Log.d("MainActivity", "Total time is ${totalTime.amount} ${totalTime.unit}")
@bentrengrove
bentrengrove / enumerateObjectsWithBlock Swift
Last active August 29, 2015 14:02
How to use the enumerateObjectsWithBlock method on NSArray with Swift
let nArray : NSArray = ["1", "2", "3"]
nArray.enumerateObjectsUsingBlock {(obj, index, stop) in
println("Object \(obj) Index \(index)")
if index == 1 {
stop.withUnsafePointer { $0.memory = true }
}
}