This file contains hidden or 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
// depends-on-plugin org.jetbrains.kotlin | |
import com.intellij.psi.util.parentOfType | |
import liveplugin.editor | |
import liveplugin.executeCommand | |
import liveplugin.psiFile | |
import liveplugin.registerAction | |
import liveplugin.show | |
import org.jetbrains.kotlin.analysis.api.fir.utils.addImportToFile |
This file contains hidden or 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
# To install recently downloaded APK file | |
function i(){ | |
lastModifiedFile=$(ls -lt | head -2) | |
echo $lastModifiedFile | |
if echo "$lastModifiedFile" | grep -q ".apk"; then | |
read yn\?"โ Do you want to install the above file? (y/n)" | |
case $yn in | |
[Yy]* ) installLastModifiedFile; echo "โ Done";; | |
[Nn]* ) echo "Cancelled APK installation";; | |
* ) echo "Please answer yes or no.";; |
This file contains hidden or 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 org.json.JSONObject | |
import java.io.File | |
const val tinyPngApiKey = "<YOUR-API-KEY-GOES-HERE>" | |
val projectDir = File("<PATH-TOPROJECT-ROOT>") | |
val supportedExtensions = listOf("png", "jpg") | |
fun main() { | |
projectDir.walk().forEach { srcFile -> | |
if (supportedExtensions.contains(srcFile.extension)) { |
This file contains hidden or 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
// Extension URL RegEx : https:\/\/console.firebase.google.com\/u\/0\/.+ | |
var accountIndex = 1 // Auto redirect account index | |
var newUrl = "https://console.firebase.google.com/u/" | |
+ accountIndex | |
+ window.location.toString().split("/u/0")[1] | |
window.location = newUrl |
This file contains hidden or 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
# To measure lauch time | |
fun launchTime(){ | |
# Config | |
LAUNCH_COUNT=10 | |
REGEX='TotalTime: (\d+)' | |
# The two params are configurable via argument | |
DEFAULT_PACKAGE_NAME='com.your.packagename' |
This file contains hidden or 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 java.io.File | |
import java.nio.file.* | |
class FileWatcher(watchFile: String) { | |
private val folderPath: Path | |
private val watchFile: String | |
init { | |
val filePath = Paths.get(watchFile) | |
val isRegularFile = Files.isRegularFile(filePath) |
This file contains hidden or 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
Column { | |
val list = remember { mutableStateListOf<String>("A") } | |
val listState = rememberLazyListState() | |
LaunchedEffect(list.size) { | |
listState.animateScrollToItem(list.lastIndex) | |
} | |
Button(onClick = { | |
list.add(System.currentTimeMillis().toString()) | |
}) { | |
Text(text = "ADD") |
This file contains hidden or 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
Column { | |
var flag by remember { mutableStateOf(false) } | |
val transition = updateTransition(targetState = flag, label = "My Animation") | |
// Method #1 | |
LaunchedEffect(transition.currentState == transition.targetState) { | |
if (transition.currentState == transition.targetState) { | |
println("Animation finished (1)") | |
} | |
} | |
// Method #2 |
This file contains hidden or 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
private val BottomRectangle = GenericShape { size, _ -> | |
// 1) | |
moveTo(0f, size.height * 0.6f) | |
// 2) | |
lineTo(size.width, size.height * 0.6f) | |
This file contains hidden or 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
// ViewState (ViewModel to UI - to render UI) | |
sealed class $component$ViewState{ | |
} | |
// Interactors (UI to ViewModel) | |
sealed class $component$Interactor{ | |
} |