Skip to content

Instantly share code, notes, and snippets.

View jumaallan's full-sized avatar
🚀
Just a man, shipping code

Juma Allan jumaallan

🚀
Just a man, shipping code
View GitHub Profile
@StevenACoffman
StevenACoffman / goGetPrivate.md
Last active July 13, 2024 20:27 — forked from dmitshur/gist:6927554
How to `go get` private repos using SSH key auth instead of password auth.

Set GOPRIVATE to match your github organization

I keep fixing this up, but if it fails for you, check if these are better maintained https://tip.golang.org/cmd/go/#hdr-Configuration_for_downloading_non_public_code and https://golang.org/ref/mod#private-modules.

Cloning the repo using one of the below techniques should work correctly but you may still be getting an unrecognized import error.

As it stands for Go v1.13, I found in the doc that we should use the GOPRIVATE variable like so:

GOPRIVATE=github.com/ORGANISATION_OR_USER_NAME go get -u -f github.com/ORGANISATION_OR_USER_NAME/REPO_NAME

The 'go env -w' command (see 'go help env') can be used to set these variables for future go command invocations.

@DRSchlaubi
DRSchlaubi / app-build.gradle.kts
Last active April 14, 2024 15:00
Flutter Kotlin Gradle DSL
import java.util.Properties
import java.nio.file.Files
val localProperties = Properties()
val localPropertiesFile = rootProject.file("local.properties").toPath()
if (Files.exists(localPropertiesFile)) {
Files.newBufferedReader(localPropertiesFile).use { reader ->
localProperties.load(reader)
}
}
@felipefpx
felipefpx / FileUploader.kt
Created August 13, 2020 01:41
Upload files using OkHttp multi-part request
fun uploadFile(
url: String,
headers: Map<String, String>,
files: Map<String, Attachment>,
formDataParts: Map<String, Any>
): Request {
val body =
MultipartBody.Builder()
.setType(MultipartBody.FORM)
.apply {
fun ConnectivityManager.observeAdapterConnectivity(): Flow<Boolean> {
return callbackFlow {
val callback = object: ConnectivityManager.NetworkCallback() {
override fun onAvailable(network: Network) {
trySendBlocking(true)
}
override fun onLost(network: Network) {
trySendBlocking(false)
}