Skip to content

Instantly share code, notes, and snippets.

View s3va's full-sized avatar

Vsevolod Semenov s3va

  • Seva's studio apartment
  • Moskva (Moscow)
View GitHub Profile
@s3va
s3va / readme.txt
Created February 5, 2024 11:20
a VIDEO not a SHORT
Just remove the 'shorts' from the URL and replace it with: 'watch?v='
E.g.: youtube.com/shorts/XXXXXXX into: youtube.com/watch?v=XXXXX
https://www.reddit.com/r/youtube/comments/um9p9u/comment/j7j7im2/
@s3va
s3va / JsoJsonPreProcessingAdapterFactorynPre
Created June 24, 2024 20:36 — forked from mypplication/JsoJsonPreProcessingAdapterFactorynPre
Gson TypeAdapterFactory to handle when API return empty array instead of null value
/**
* Usage : gsonBuilder.registerTypeAdapterFactory(JsonPreProcessingAdapterFactory())
**/
class JsonPreProcessingAdapterFactory : TypeAdapterFactory {
override fun <T> create(gson: Gson, type: TypeToken<T>): TypeAdapter<T>? {
if (!Object::class.java.isAssignableFrom(type.rawType) ||
Iterable::class.java.isAssignableFrom(type.rawType)
@s3va
s3va / serializationtype.kt
Last active September 7, 2024 16:55
koltin serialization polymorphizm. "type" field in json
import kotlinx.serialization.DeserializationStrategy
import kotlinx.serialization.Serializable
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.*
import kotlinx.serialization.SerialName
@Serializable
@JsonClassDiscriminator("mytype")
sealed class ContentRequest
@s3va
s3va / CrateBitmapWithCircleInIt.kt
Created November 26, 2024 10:54
Crate Bitmap With Circle In It
// https://stackoverflow.com/a/68228461/11798617
private fun drawCircle300(): Bitmap? {
var radius = 150f
val bitmap = Bitmap.createBitmap(
(radius * 2).toInt(),
(radius * 2).toInt(),
Bitmap.Config.ARGB_8888
)