Skip to content

Instantly share code, notes, and snippets.

View YoloSwagBot's full-sized avatar

Barson Cath YoloSwagBot

  • App Str LLC
  • California
View GitHub Profile
@YoloSwagBot
YoloSwagBot / SingletonHolder
Created September 6, 2019 20:30
Kotlin Singleton Pattern
import PACKAGE
open class SingletonHolder<out T: Any, in A>(creator: (A) -> T) {
private var creator: ((A) -> T)? = creator
@Volatile private var instance: T? = null
fun getInstance(arg: A): T {
val i = instance
if (i != null) {
return i
@YoloSwagBot
YoloSwagBot / OurDB
Created September 6, 2019 20:32
Room DataBase object
package com.appstr.bruhusrs.data
import android.content.Context
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import com.appstr.bruhusrs.singleton.SingletonHolder
import com.appstr.bruhusrs.util.DATABASE_NAME
@YoloSwagBot
YoloSwagBot / color_dump
Last active September 7, 2019 20:39
Colors in xml, dump
<!-- Pink Colors -->
<color name="pink_50">#FCE4EC</color>
<color name="pink_100">#F8BBD0</color>
<color name="pink_200">#F48FB1</color>
<color name="pink_300">#F06292</color>
<color name="pink_400">#EC407A</color>
<color name="pink_500">#E91E63</color>
<color name="pink_600">#D81B60</color>
<color name="pink_700">#C2185B</color>