Skip to content

Instantly share code, notes, and snippets.

View philipplackner's full-sized avatar

Philipp Lackner philipplackner

  • Germany
View GitHub Profile
@Composable
fun PostFilterButton(
text: String,
selected: Boolean,
onClick: () -> Unit,
modifier: Modifier = Modifier
) {
Button(
onClick = onClick,
shape = RoundedCornerShape(50f),
1. Download Git Bash (only if on Windows)
2. Go to your users folder and open the .ssh folder. Then open Git Bash / Terminal there and generate a key pair:
ssh-keygen -m PEM -t rsa
3. Copy the key to your server:
ssh-copy-id -i <keyname> <user>@<host>
5. Login to your Ubuntu server via SSH:
ssh -i <keyname> <user>@<host>
@philipplackner
philipplackner / DeploymentSteps.txt
Created November 24, 2021 21:53
Ktor VPS Server Deployment Steps
1. Download Git Bash (only if on Windows)
2. Go to your users folder and open the .ssh folder. Then open Git Bash / Terminal there and generate a key pair:
ssh-keygen -m PEM -t rsa -b 2048
3. Copy the key to your server:
ssh-copy-id -i <keyname> <user>@<host>
5. Login to your Ubuntu server via SSH:
ssh -i <keyname> <user>@<host>
1. hiltvm (applicable in top-level)
@dagger.hilt.android.lifecycle.HiltViewModel
class $NAME$ @javax.inject.Inject constructor(
$PARAM$
) : androidx.lifecycle.ViewModel() {
$END$
}
2. vmstatefunc (applicable in class)
private val _$NAME$ = androidx.compose.runtime.mutableStateOf<$TYPE$>($INITIAL_VALUE$)
import android.content.Context
import android.net.ConnectivityManager
import android.net.NetworkCapabilities
import android.os.Build
fun hasInternetConnection(context: Context): Boolean {
val connectivityManager =
context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
val activeNetwork = connectivityManager.activeNetwork ?: return false