Skip to content

Instantly share code, notes, and snippets.

View MeNiks's full-sized avatar

Nikhilesh MeNiks

  • Pune
View GitHub Profile
@MeNiks
MeNiks / first_java_program.md
Created September 11, 2024 03:18
First Java Program
  1. Install Java Development Kit (JDK) Download and install the latest version of JDK from the Oracle website or use OpenJDK. After installation, make sure the java and javac commands are available in your system's PATH by running java -version and javac -version in the terminal.
  2. Set Up Your Development Environment You can use any text editor (like Notepad, VS Code, or Sublime Text) or an Integrated Development Environment (IDE) like IntelliJ IDEA, Eclipse, or NetBeans.
  3. Write the HelloWorld Program Open your text editor or IDE and create a new file named HelloWorld.java.

Type the following code into the file:

@MeNiks
MeNiks / UITestingExt.kt
Last active February 16, 2022 07:24
Espresso UI Testing Extensions
package com.yourpackagename
import android.os.Environment
import android.view.View
import android.view.ViewGroup
import android.widget.EditText
import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.test.InstrumentationRegistry.getTargetContext
import androidx.test.espresso.Espresso
@MeNiks
MeNiks / JsonExtensions.kt
Last active June 20, 2024 11:10
Add/Update properties of kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.jsonObject
fun JsonObject.addUpdateJsoObject(updateJsonObject: JsonObject): JsonObject {
return JsonObject(
toMutableMap()
.apply {
updateJsonObject.forEach { (key, je) ->
put(key, je)
}
@MeNiks
MeNiks / RealPathUtil.kt
Last active July 10, 2024 08:57
Kotlin code to get real path / sd card path from intent data while browsing file.
import android.annotation.SuppressLint
import android.content.ContentUris
import android.content.Context
import android.content.CursorLoader
import android.database.Cursor
import android.net.Uri
import android.os.Build
import android.os.Environment
import android.provider.DocumentsContract
import android.provider.MediaStore