Skip to content

Instantly share code, notes, and snippets.

View realityexpander's full-sized avatar
🤓
Kotlin Multi-platoform, Android Native, iOS & Web

Chris Athanas realityexpander

🤓
Kotlin Multi-platoform, Android Native, iOS & Web
View GitHub Profile
@realityexpander
realityexpander / masonry-layout-example
Created April 7, 2023 19:50
Improve example of Masonry grid.
<style>
/* CSS Grid Layout */
.grid-container {
width: 600px;
-webkit-column-count: 3;
-moz-column-count: 3;
column-count: 3;
-webkit-column-gap: 15px;
-moz-column-gap: 15px;
@realityexpander
realityexpander / FunctionInterfaceSAM
Created February 10, 2023 22:37
Example of Function Interface (SAM)
fun interface Translatable {
fun translate(
fromLanguage: Language,
fromText: String,
toLanguage: Language
): String
fun whackamole() {
@realityexpander
realityexpander / build.gradle.kts(:shared)
Last active October 17, 2022 22:56
for KMM @TypeParceler article
// build.gradle.kts(:shared
plugins {
kotlin("multiplatform")
id("com.android.library")
id("kotlin-parcelize") // add this
id("kotlin-kapt") // add this
//…rest of defintions…
}
kotlin {
@realityexpander
realityexpander / CommonMainPlatform.kt
Created October 14, 2022 23:42
for KMM @TypeParceler Article
// commonMain/…/Platform.kt
import kotlinx.datetime.LocalDateTime
// For Android @Parcelize
@OptIn(ExperimentalMultiplatform::class)
@OptionalExpectation
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.BINARY)
expect annotation class CommonParcelize()
@realityexpander
realityexpander / androidMainPlatform.kt
Last active October 17, 2022 22:55
for KMM @TypeParceler article
// androidMain/…/Platform.kt
import android.os.Parcel
import android.os.Parcelable
import kotlinx.datetime.LocalDateTime
import kotlinx.datetime.toLocalDateTime
import kotlinx.parcelize.Parceler // NOTE: kotlinx.parcelize.*
import kotlinx.parcelize.Parcelize
import kotlinx.parcelize.TypeParceler
@realityexpander
realityexpander / sharedcommonMaindomainnoteNote.k
Last active October 17, 2022 22:55
for KMM @TypeParceler article
// ../shared/commonMain/…/domain/note/Note.kt
import kotlinx.datetime.LocalDateTime
@CommonParcelize // this annotation will be ignored by iOS
data class Note(
val id: Long?,
val title: String,
val content: String,
val colorHex: Long,
@realityexpander
realityexpander / iosMainPlatform.kt
Last active October 17, 2022 22:55
for KMM @TypeParceler article
// iosMain/…/Platform.kt
import kotlinx.datetime.LocalDateTime
// Note: no need to define CommonParcelize here (bc its @OptionalExpectation)
actual interface CommonParcelable // not used on iOS
// Note: no need to define CommonTypeParceler<T,P : CommonParceler<in T>> here bc its an @OptionalExpectation
actual interface CommonParceler<T> // not used on iOS
actual object LocalDateTimeParceler : CommonParceler<LocalDateTime> // not used on iOS

Keybase proof

I hereby claim:

  • I am realityexpander on github.
  • I am realityexpander (https://keybase.io/realityexpander) on keybase.
  • I have a public key ASAhz4adTGeJiLlop-BdPQAsSj36DbtEK5eY0hOG_s-beQo

To claim this, I am signing this object:

@realityexpander
realityexpander / AdbCommands
Last active March 5, 2020 01:07 — forked from Pulimet/AdbCommands
Adb useful commands list
adb help // List all comands
== Adb Server
adb kill-server
adb start-server
== Adb Reboot
adb reboot
adb reboot recovery
adb reboot-bootloader
/*
Problem:
['Tokyo', 'London', 'Rome', 'Donlon', 'Kyoto', 'Paris']
// YOUR ALGORITHM