Skip to content

Instantly share code, notes, and snippets.

View AniketSK's full-sized avatar
😀
Available for consulting on Android, maybe fulltime for the right company!

Aniket Kadam AniketSK

😀
Available for consulting on Android, maybe fulltime for the right company!
View GitHub Profile
package live.hms.video.media.tracks;
import android.content.Context;
import android.os.SystemClock;
import org.webrtc.CapturerObserver;
import org.webrtc.JavaI420Buffer;
import org.webrtc.Logging;
import org.webrtc.SurfaceTextureHelper;
import org.webrtc.VideoCapturer;
@AniketSK
AniketSK / settings.json
Last active July 23, 2021 11:35
Settings to turn off any kind of tooltip for vscode. This is particularly helpful if you're trying to write text and the constant tooltips are messing with you. By default it doesn't consider mdx markdown, so these settings make sure it also considers mdx, while applying the changes to markdown files.
{
"files.autoSave": "afterDelay",
"editor.suggest.snippetsPreventQuickSuggestions": false,
"files.associations": {
"*.mdx": "markdown",
"*.md":"markdown"
},
"[markdown]":{
"editor.wordWrap": "on",
"editor.quickSuggestions": false,
@AniketSK
AniketSK / RealmModule.kt
Created December 30, 2020 10:29
A "module" in the Dependency Injection sense, which handles connecting to realm anonnymously for a given appid and prepares a synced realm instance for Android
package com.example.emojigarden
import android.app.Application
import android.util.Log
import io.realm.Realm
import io.realm.mongodb.App
import io.realm.mongodb.AppConfiguration
import io.realm.mongodb.Credentials
import io.realm.mongodb.User
@AniketSK
AniketSK / LceGeneric.kt
Created August 28, 2020 11:32
A way to define a generic kotlin lce.
sealed class Lce<T> {
class Loading<T> : Lce<T>() // Can't be an object since it wouldn't have the T otherwise.
data class Content<T>(val data : T) : Lce<T>()
data class Error<T>(val error : Throwable) : Lce<T>()
}
@AniketSK
AniketSK / MaxHeap.kt
Created August 9, 2020 05:34
Trying out MaxHeaps
package com.aniketkadam.heaps
import org.jetbrains.annotations.TestOnly
class MaxHeap<T : Comparable<T>> {
private val items: MutableList<T> = mutableListOf()
fun insertAll(items: List<T>): Unit = items.forEach(::insert)
fun insert(item: T): Unit {
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/placesRecyclerView"
@AniketSK
AniketSK / AttributeExtensions.kt
Created February 1, 2020 13:32
Used to make when clauses exhaustive
package com.aniketkadam.dogether.extensions
val <T> T.exhaustive: T
get() = this
@AniketSK
AniketSK / GoalListRepository.kt
Created October 25, 2019 18:56
A way to combine data from two collections when you can't use a collectionGroup because you're not supposed to be able to access all the data from one of the lists!
package com.aniketkadam.dogether.goals
import androidx.lifecycle.LiveData
import androidx.lifecycle.MediatorLiveData
import com.aniketkadam.dogether.auth.FIREBASE_USER_ID
import com.aniketkadam.dogether.di.data.PRIVATE_GOALS_LOCATION_NAME
import com.aniketkadam.dogether.di.data.PUBLIC_GOALS_LOCATION_NAME
import com.aniketkadam.dogether.goals.data.GoalsListLiveData
import com.google.firebase.firestore.CollectionReference
import com.google.firebase.firestore.QueryDocumentSnapshot
@AniketSK
AniketSK / firestore.rules
Created October 25, 2019 05:21
Some sample firebase rules.
rules_version = '2';
function isAuthenticated(request){
return request.auth != null && request.auth.uid != null
}
function isDocUidSameAsUserUid(request){
return request.auth.uid == request.resource.data.uid
}