Skip to content

Instantly share code, notes, and snippets.

View hoc081098's full-sized avatar
✝️
"The Lord is my shepherd; I shall not want." — Psalm 23:1, KJV

Petrus Nguyễn Thái Học hoc081098

✝️
"The Lord is my shepherd; I shall not want." — Psalm 23:1, KJV
View GitHub Profile
@hoc081098
hoc081098 / mobile-clean.sh
Last active July 9, 2026 09:38
Mobile Build Artifact Cleaner. Recursively clean build artifacts and generated cache files from Flutter, Android, iOS, and macOS mobile app projects without running Gradle, Flutter, CocoaPods, or Xcode clean commands. This script is useful for reclaiming disk space, resetting local generated files, and cleaning nested mobile repositories in mono…
#!/usr/bin/env sh
set -eu
# ------------------------------------------------------------------------------------
# Usage examples:
# sh mobile-clean.sh .
# sh mobile-clean.sh --yes .
# sh mobile-clean.sh --yes --pods .
# sh mobile-clean.sh --yes --pods --derived-data .
@hoc081098
hoc081098 / buildStore.kt
Created June 11, 2024 08:07
buildStore.kt
// FlowRedux is from
https://github.com/hoc081098/GithubSearchKMM-Compose-SwiftUI/tree/master/flowredux/src/commonMain/kotlin/com/hoc081098/flowredux
package com.hoc081098.flowredux.dsl
import com.hoc081098.flowredux.FlowReduxStore
import com.hoc081098.flowredux.SideEffect
import com.hoc081098.flowredux.createFlowReduxStore
import com.hoc081098.flowredux.liftAction
import kotlinx.coroutines.CoroutineScope
@hoc081098
hoc081098 / MainActivity.kt
Created March 30, 2024 19:30
MainActivity.kt
package com.example.roomdb;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
package com.example.roomdb;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
private void API_Get_List() {
ExecutorService executor = Executors.newSingleThreadExecutor();
Handler handler = new Handler(Looper.getMainLooper());
executor.execute(new Runnable() {
@Override
public void run() {
final StringRequest request = new StringRequest(Request.Method.POST,
@hoc081098
hoc081098 / MainActivity.kt
Created March 30, 2024 16:38
MainActivity.kt
package com.example.roomdb;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import 'dart:async';
extension SplitExtension<T> on Stream<T> {
Stream<T> split() {
final controllers = <MultiStreamController<T>>[];
var index = -1;
var done = false;
StreamSubscription<T> subscription;
return Stream.multi(
public class ChannelsEventBus {
private val _channels = hashMapOf<KClass<*>, Channel<Any>>()
private fun createChannel(key: KClass<*>) = synchronized(this) { _channels.getOrPut(key) { Channel(Channel.UNLIMITED) } }
public fun send(event: Any): Unit = createChannel(event::class).trySend(event).let { }
@Suppress("UNCHECKED_CAST")
public fun <T : Any> receiveAsFlow(type: KClass<T>): Flow<T> = flow {
createChannel(type)
@hoc081098
hoc081098 / proguard-rules.pro
Created October 17, 2023 08:24
proguard-rules.pro
#### Nav
-keepnames class androidx.navigation.fragment.NavHostFragment
-keepnames class * extends android.os.Parcelable
-keepnames class * extends java.io.Serializable
#### OkHttp, Retrofit and Moshi
-dontwarn okhttp3.**
@hoc081098
hoc081098 / rememberIsScrollingUpState.kt
Created August 19, 2023 18:36
rememberIsScrollingUpState.kt
@Composable
private fun LazyListState.rememberIsScrollingUpState(): State<Boolean> {
var previousIndex by remember(this) { mutableIntStateOf(firstVisibleItemIndex) }
var previousScrollOffset by remember(this) { mutableIntStateOf(firstVisibleItemScrollOffset) }
return remember(this) {
derivedStateOf {
if (previousIndex != firstVisibleItemIndex) {
previousIndex > firstVisibleItemIndex