Skip to content

Instantly share code, notes, and snippets.

View realityexpander's full-sized avatar
🤓
Kotlin Multi-Platform, Android, iOS, Web & Ktor Back-end

Chris Athanas realityexpander

🤓
Kotlin Multi-Platform, Android, iOS, Web & Ktor Back-end
View GitHub Profile
@BracketCove
BracketCove / LoadingSpinner.kt
Created October 21, 2022 16:17
Easy animated loading spinner with Glide (or whatever image loading library)
//use this in your Recyclerview or whereever for asynchornous image loading
Glide.with(holder.itemView.context)
.load(avatarUrl)
.centerCrop()
.placeholder(
CircularProgressDrawable(holder.itemView.context).apply {
setColorSchemeColors(
ContextCompat.getColor(holder.itemView.context, R.color.colorPrimary)
)
@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 {
@Composable
fun FlingAnimation() {
val offset = remember { Animatable(Offset(0f, 0f), Offset.VectorConverter) }
Box(
modifier = Modifier
.fillMaxSize()
.pointerInput(Unit) {
coroutineScope {
while (true) {
val position = awaitPointerEventScope {
@loehnertz
loehnertz / Extensions.kt
Created December 6, 2021 20:55
Handy Kotlin Extension Functions
/**
* Swaps the order of the elements of the given [Pair] in a type-safe manner.
*
* Example:
* ```
* Pair("David", 32).swap() // Pair(32, "David")
* ```
*/
fun <A, B> Pair<A, B>.swap(): Pair<B, A> = this.second to this.first
@Mashpoe
Mashpoe / main.c
Last active January 25, 2025 13:25
ASCII Tesseract Rotation C Program
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <windows.h>
// width and height of screen
#define ww 100
#define wh 50
void clr(CHAR_INFO* d)
@stevdza-san
stevdza-san / Converters.kt
Last active March 31, 2024 10:09
@TypeConverter
class Converters {
@TypeConverter
fun fromBitmap(bitmap: Bitmap): ByteArray {
val outputStream = ByteArrayOutputStream()
bitmap.compress(Bitmap.CompressFormat.PNG, 100, outputStream)
return outputStream.toByteArray()
}
@TypeConverter
@mitchtabian
mitchtabian / MainActivity.kt
Last active December 28, 2022 15:24
Basics #4: Dependencies that require dependencies (Concrete classes that you own)
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.fragment.app.Fragment
import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject
@AndroidEntryPoint
class MainActivity : AppCompatActivity() {
@Inject
/*
Problem:
['Tokyo', 'London', 'Rome', 'Donlon', 'Kyoto', 'Paris']
// YOUR ALGORITHM
@Pulimet
Pulimet / AdbCommands
Last active April 26, 2025 13:51
Adb useful commands list
Hi All!
I've recently launched a tool that wraps many of the commands here with a user interface. This desktop application is currently available for macOS. There's a roadmap outlining planned features for the near future.
Feel free to request any features you'd like to see, and I'll prioritize them accordingly.
One of the most important aspects of this application is that every command executed behind the scenes is displayed in a special log section. This allows you to see exactly what’s happening and learn from it.
Here's the link to the repository: https://github.com/Pulimet/ADBugger
App Description:
ADBugger is a desktop tool designed for debugging and QA of Android devices and emulators. It simplifies testing, debugging, and performance analysis by offering device management, automated testing, log analysis, and remote control capabilities. This ensures smooth app performance across various setups.
@subfuzion
subfuzion / curl.md
Last active April 24, 2025 13:48
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.