Skip to content

Instantly share code, notes, and snippets.

View kaushiknsanji's full-sized avatar
💭
💭

Kaushik N. Sanji kaushiknsanji

💭
💭
View GitHub Profile
@GokhanArik
GokhanArik / NetworkStateManager.kt
Created March 12, 2020 03:11
Check Internet Connection in Android 21+
package manager
import android.content.Context
import android.net.ConnectivityManager
import android.net.Network
import android.net.NetworkCapabilities
import android.net.NetworkRequest
import android.os.Build
import android.util.Log
import com.jakewharton.rxrelay2.BehaviorRelay
@JoseAlcerreca
JoseAlcerreca / EventObserver.kt
Created April 26, 2018 12:14
An Observer for Events, simplifying the pattern of checking if the Event's content has already been handled.
/**
* An [Observer] for [Event]s, simplifying the pattern of checking if the [Event]'s content has
* already been handled.
*
* [onEventUnhandledContent] is *only* called if the [Event]'s contents has not been handled.
*/
class EventObserver<T>(private val onEventUnhandledContent: (T) -> Unit) : Observer<Event<T>> {
override fun onChanged(event: Event<T>?) {
event?.getContentIfNotHandled()?.let { value ->
onEventUnhandledContent(value)

Aligning images

This is a guide for aligning images.

See the full Advanced Markdown doc for more tips and tricks

left alignment

@PurpleBooth
PurpleBooth / README-Template.md
Last active May 6, 2024 07:22
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@MarcDiethelm
MarcDiethelm / Contributing.md
Last active May 1, 2024 18:06
How to contribute to a project on Github

This text now lives at https://github.com/MarcDiethelm/contributing/blob/master/README.md. I turned it into a Github repo so you can, you know, contribute to it by making pull requests.


Contributing

If you want to contribute to a project and make it better, your help is very welcome. Contributing is also a great way to learn more about social coding on Github, new technologies and and their ecosystems and how to make constructive, helpful bug reports, feature requests and the noblest of all contributions: a good, clean pull request.

@granoeste
granoeste / EachDirectoryPath.md
Last active April 4, 2024 22:32
[Android] How to get the each directory path.

System directories

Method Result
Environment.getDataDirectory() /data
Environment.getDownloadCacheDirectory() /cache
Environment.getRootDirectory() /system

External storage directories

@markusfisch
markusfisch / README.md
Last active January 21, 2023 15:15
Handy shell script that eases building and running Android apps from the command line with ant and adb

Handy Android shortcuts

This little script eases building, running, testing and analyzing Android apps with [ant][2] and [adb][1].

You may also see it as interactive dictionary of useful [adb commands][1].

How to use