This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pressTool() | |
{ | |
xdotool keydown 'c' | |
sleep 0.090 | |
xdotool keyup 'c' | |
sleep 0.042 | |
xdotool keydown 'Shift_R+Delete+R' | |
sleep 0.005 | |
xdotool keyup 'Shift_R+Delete+R' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// implementation("org.zeroturnaround:zt-exec:1.12") LIBRARY USAGED | |
import androidx.compose.runtime.Composable | |
import androidx.compose.runtime.collectAsState | |
import kotlin.coroutines.resume | |
import kotlinx.coroutines.channels.awaitClose | |
import kotlinx.coroutines.flow.Flow | |
import kotlinx.coroutines.flow.callbackFlow | |
import kotlinx.coroutines.flow.collect | |
import kotlinx.coroutines.flow.flow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xmlns="http://maven.apache.org/POM/4.0.0" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<artifactId>mainModule</artifactId> | |
<groupId>me.devsrsouza</groupId> | |
<version>1.0</version> | |
<packaging>jar</packaging> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import kotlinx.coroutines.flow.StateFlow | |
import kotlin.reflect.KClass | |
interface Router<T : Any> { | |
// null if the backStack was cleared and the app was closed | |
val currentDirection: StateFlow<T?> | |
// will push the new direction | |
// if pop is not null, it will pop all previous direction down to the latest appearance of the pop kclass | |
fun push( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@file:DependsOn("com.squareup:kotlinpoet:1.6.0") | |
import com.squareup.kotlinpoet.* | |
import java.io.File | |
val maxParameterCount = 12 | |
fun typeName(it: Int) = (65 + it).toChar().toString() | |
val tupleClasses = Array(maxParameterCount) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.view.LayoutInflater | |
import android.view.View | |
import android.view.ViewGroup | |
import androidx.recyclerview.widget.DiffUtil | |
import androidx.recyclerview.widget.ListAdapter | |
import androidx.recyclerview.widget.RecyclerView | |
import androidx.viewbinding.ViewBinding | |
typealias InflateBindingCallback<BINDING> = (LayoutInflater, ViewGroup, viewType: Int) -> BINDING | |
typealias GetViewFromBindingCallback<BINDING> = (BINDING) -> View |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline fun <T> List<T>.selectRouletteWheelWithMinimum( | |
min: Double = 100.0, | |
sum: (T) -> Double | |
): T? { | |
if(isEmpty()) return null | |
val total = reversed().sumByDouble(sum) | |
val random = (Math.random() * if(total > min) total else min) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.app.Service | |
import android.content.ComponentName | |
import android.content.Context | |
import android.content.Intent | |
import android.content.ServiceConnection | |
import android.os.IBinder | |
import kotlin.coroutines.resume | |
import kotlin.coroutines.suspendCoroutine | |
suspend inline fun <reified S : Service, B : IBinder> Context.connectService( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package br.com.devsrsouza.kotlinbukkitapi.controllers | |
import kotlinx.coroutines.delay | |
import kotlinx.coroutines.runBlocking | |
import java.util.concurrent.ConcurrentHashMap | |
import kotlin.coroutines.CoroutineContext | |
import kotlin.coroutines.coroutineContext | |
import kotlin.system.measureTimeMillis | |
fun main() { |