Skip to content

Instantly share code, notes, and snippets.

View mbobiosio's full-sized avatar
🎯
Focusing

Mbuodile Obiosio mbobiosio

🎯
Focusing
View GitHub Profile
@mbobiosio
mbobiosio / README.md
Created October 5, 2020 13:54 — forked from lopspower/README.md
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

Interview Questions

Kotlin

Q1: What is a primary constructor in Kotlin? ☆☆

Answer: The primary constructor is part of the class header. Unlike Java, you don't need to declare a constructor in the body of the class. Here's an example:

@mbobiosio
mbobiosio / Extensions.kt
Last active November 15, 2023 16:58 — forked from albertogiunta/Extensions.kt
Extension functions (Kotlin) & build.gradle files for Android projects
/**
* ANY
*/
fun Any.toJson(): String = GsonInitializer.toJson(this)
/**
* String to Inches
**/
internal fun convertStringToInches(centimeters: String) : String =
(BigDecimal(centimeters.toDouble() * 0.393701).setScale(3, RpundingMode.HALF_EVEN)).toString()