Skip to content

Instantly share code, notes, and snippets.

@kenkoro
kenkoro / SharedViewModelUtils.kt
Last active April 10, 2025 08:23
Shared hilt view-model w/ compose
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.ViewModel
import androidx.navigation.NavBackStackEntry
import androidx.navigation.NavHostController
@Composable
inline fun <reified T : ViewModel> NavBackStackEntry.sharedHiltViewModel(
navController: NavHostController,

Adopted from here https://topaxi.codes/use-npm-without-root-or-sudo-rights/

I'm saving this as a gist and modifying it to ensure that if the original blog post disappears it lives on somewhere.

Added some notes for Ubuntu 18.04 and similar.

Today we're going to setup our npm installation to be used without root or sudo rights.

By default, if you install packages globally with npm, npm tries to install them into a system directory (i.e. /usr/local/lib/node_modules). With the next steps, we're going to use your home directory for those files.