Skip to content

Instantly share code, notes, and snippets.

@ryancfogarty
ryancfogarty / ActivityDetailResponse.json
Last active October 21, 2025 22:18
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
}