Skip to content

Instantly share code, notes, and snippets.

@ryancfogarty
ryancfogarty / animatedSnapTo.kt
Last active November 18, 2025 21:17
animated
private suspend fun LottieAnimatable.animatedSnapTo(
composition: LottieComposition?,
targetProgress: Float,
velocity: Float = ANIMATED_SNAP_VELOCITY,
) {
val currentProgress = this.progress
if (currentProgress == targetProgress) return
coroutineScope {
val direction = (targetProgress - currentProgress).unitVector()
val speed = velocity * direction
@ryancfogarty
ryancfogarty / current.png
Created November 5, 2025 16:38
Activity Details deeplink
âPNG

���
IHDR��≤��√���,†›j���IDATxÏ›ºe€«Òk ;Û’GÏÓn¡Ó¬@A,T § B∞¿@∞±QBTª„±x˜?0sf˜ÏÓŸfiâÓ3uœfl{ŒÓufgfÕ Ä� Ä�!hd¸C�(@Ĩ Ä�A ê
 H–@�@ äÏÅlq)@�@†r≤ï≥•d®ù�5#Ä�ƒ@Ä@6ÉL@�@�Å‹·‹J Œq£’ Ä� Ä@Ïdc�Ä@Ì®@�ÅRdK—c_@�@†z‘î&@ õ¬" Ä� Ä@8d√1N¥Å⁄ P3 Ä� ê
Ë¿–,@�ß�≠Æû�Ålı¨© @�@†å≤eƒ§(j'@Õ Ä�ƒOÄ@6~c^Ø«3g~aÎÆ€úÑA¡«@óSŒØw<±¢zgûŸß‡1„wù◊:éÅ˘«�Ø˘Åy˝xı’∑ã~·$ê-öé@�@�j)@ [K}Íéõ�˝E�@�Å2
»ñ3*E5IvÑdÜAfɉ·¡ˇÄ
pÃf>fq ≥ mèÍÒ[Æó—FÂ*àr¢#∞Íö´⁄õÔN&aPÔzÌe—9–#ÿìÅÉ˚÷3~óy-„‡⁄1∞…fïÌò@∂lî˙Å� Ä�· ê
«8—J@�Ç*@ª®ô�ÅlÕË©@�@†ŸRÙÿ∑v‘Ş˝◊~˛˘Á¨È˜flD;i Ä@pfÕ˙=Î˚àficfœûùµÒ≤YiÿÄ� Ä@tË Q êç‚®“'@�@ ≤1‰⁄uëö@�@�Å  »VŒñí@�(LÄ‹ Pê�ÅlA\dF�@�ä�ÅlPF¢v̆f@�@ î≤°6ç� P;jF�ņ»e$h Ä� Ä@A≤q’.35#Ä� Ä�§
»¶z∞Ñ� 
@ryancfogarty
ryancfogarty / ActivityDetailResponse.json
Last active October 30, 2025 15:14
Micro Cashback Mock Responses
{
"type": "micro_cashback",
"detail_uuid": "fbdf6e14-bfea-4d4b-8504-842d203d6eba",
"site_name": "Starbucks",
"brand_image": "https://static.upside-services.com/assets/app/brands/restaurant/pwgc/starbucks_96x96.png",
"total_spent": {
"amount": 30.50,
"currency": "USD"
},
"transaction_timestamp": "2025-10-01T14:49:21+00:00",
@ryancfogarty
ryancfogarty / example1.kt
Last active September 16, 2025 17:30
intent-ception
sealed class Intent {
data object IntentA : Intent
data object IntentB : Intent
}
init {
onIntent(IntentA)
}
override suspend fun ExecuteIntentScope<Action>.executeIntent(mviIntent: Intent) {
@ryancfogarty
ryancfogarty / EventDao.kt
Created September 9, 2025 15:25
DB Flow
@Dao
interface EventDao {
@Query("SELECT count(*) FROM EventEntity")
fun getCountAsFlow(): Flow<Int>
}
@ryancfogarty
ryancfogarty / AndroidAnalytics.kt
Created September 4, 2025 14:11
AndroidAnalytics Init
single<CoreAnalytics> {
AndroidAnalytics(
writeKey = AnalyticsBuildKonfig.segmentKey,
context = get()
) {
trackApplicationLifecycleEvents = true
collectDeviceId = true
flushInterval = 10
defaultSettings = run {
val settings = <redacted code which decodes settings from secret json key>
{
"generation_status": "COMPLETED",
"mapview_pins": [
{
"offer_uuid": "4907a3d3-71e9-4ca4-9539-1be0238e814d",
"offer_type": "INCREMENTAL",
"offer_category": "GAS",
"location": {
"geo_location": {
"longitude": -122.0319137,
@ryancfogarty
ryancfogarty / hardcoded.kt
Last active March 19, 2025 14:32
hardcoded dev decisions
private val onboardingMapiRfaaDecisionMap = mapOf(
"displayOnboardingPopup" to Decision(
flag = FeatureFlag.Upside.OnboardingMapiRfaa,
enabled = true,
variables = OnboardingMapiVariables(true),
)
"hideOnboardingPopup" to Decision(
flag = FeatureFlag.Upside.OnboardingMapiRfaa,
enabled = true,
sealed interface FeatureFlagType {
val value: Any?
data class Boolean(override val value: kotlin.Boolean) : FeatureFlagType
data class Int(override val value: kotlin.Int) : FeatureFlagType
data class Double(override val value: kotlin.Double) : FeatureFlagType
data class String(override val value: kotlin.String) : FeatureFlagType
data class Map(override val value: kotlin.collections.Map<kotlin.String, FeatureFlagType>) : FeatureFlagType
}
@PerActivity
class BottomSheetDialogCommunicator @Inject constructor() {
val flow = MutableSharedFlow<BottomSheetDialogMessage>()
}
sealed interface BottomSheetDialogMessage
sealed interface ReminderMessage : BottomSheetDialogMessage {
data class Test(val text: String) : ReminderMessage
}