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
@AniketSK
AniketSK / .bash_aliases
Created August 5, 2017 06:21
A useful bash aliases file.
# Exits the terminal
alias e=exit
# Clears the window so you can see what's going on!
alias c=clear
# Uninstall your current app.
alias u='adb uninstall com.aniket'
# Clear data for the current app.
@AniketSK
AniketSK / dal-rice-recipe.txt
Last active June 20, 2018 15:39
A recipe for some nice spicy dal rice
Two medium length dark green chilis.
1 cup rice, 2 cups dal.
1 tsp: mustard seeds, asafoetida, cumin.
1 - 2 cloves of garlic
1 tbs or so of turmeric
Optional:
1 large tomato
1 small onion
@AniketSK
AniketSK / ExerciseJava.java
Last active July 5, 2018 08:03
A demonstration of setting and accessing time in a unit-safe way.
import java.util.concurrent.TimeUnit;
public class ExerciseJava {
private long duration;
public void setDuration(long duration, TimeUnit unit) {
this.duration = TimeUnit.MILLISECONDS.convert(duration, unit);
}
@AniketSK
AniketSK / build.gradle
Created November 14, 2018 18:58
Demonstration of how to extract dependencies from your build.gradle file.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
// Load dependencies
buildscript {
ext.kotlin_version = "1.3.0"
repositories {
google()
jcenter()
@AniketSK
AniketSK / ChannelIds.kt
Created December 1, 2018 17:52
Creating a list of and registering channels for notifications reliably.
package com.aniketkadam.premail.base.notifications
import android.app.NotificationManager
import androidx.annotation.StringRes
import com.aniketkadam.premail.R
enum class ChannelIds(
@StringRes val channelNameRes: Int, @StringRes val channelDescriptionRes: Int,
val importance: Int
) {
@AniketSK
AniketSK / ObservableBroadcastReceiver.kt
Created December 11, 2018 14:18
Generic Observable for turning BroadcastManagers into observable streams.
package com.aniketkadam.wifimanager.androidhelpers
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import io.reactivex.Observable
import io.reactivex.ObservableEmitter
import io.reactivex.ObservableOnSubscribe
import io.reactivex.disposables.Disposable
companion object {
/**
* Creates an intent for the TaskEditor state machine.
*
* Utility function to cut down on boilerplate.
*/
inline fun <reified S : TaskEditorState> editorIntent(
crossinline block: S.() -> TaskEditorState
): Intent<TaskEditorState> {
return intent {
¯\_(ツ)_/¯
@AniketSK
AniketSK / Document.js
Created June 30, 2019 14:13
A higher order component to abstract away the connection to Firebase.
import React from 'react';
import firebase from 'firebase/app';
import { FormValidation } from '../../constants';
class Document extends React.Component {
constructor(props) {
super(props);
this.db = firebase.firestore();
this.db.settings({ timestampsInSnapshots: true });
this.willSubscribe = this.props.path != null;
@AniketSK
AniketSK / AndroidManifest.xml
Created August 4, 2019 13:39
A rule to disable animations and all that other stuff you're supposed to do before running integration tests on a device. You will need this import among others. androidTestImplementation "androidx.test.uiautomator:uiautomator:2.2.0" the idea of it was taken from the book Android Espresso Revealed: Writing Automated Unit Tests by Denys Zelenchuk…
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="${applicationId}">
<uses-sdk tools:overrideLibrary="android_libs.ub_uiautomator"/>
</manifest>