Skip to content

Instantly share code, notes, and snippets.

View jdsingh's full-sized avatar
🎯
Focusing

Jagdeep Singh jdsingh

🎯
Focusing
View GitHub Profile
@objcode
objcode / ConcurrencyHelpers.kt
Last active August 22, 2024 16:50
Helpers to control concurrency for one shot requests using Kotlin coroutines.
/* Copyright 2019 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@Takhion
Takhion / RxFilterIsInstance.kt
Last active June 29, 2020 17:04 — forked from rock3r/RxFilterIsInstance.kt
Port Kotlin's awesome filterIsInstance() to RxJava — one call to filter by type and map-cast to that type
package me.seebrock3r.extensions.reactivex
import io.reactivex.Flowable
import io.reactivex.Maybe
import io.reactivex.Observable
import io.reactivex.Single
@Suppress("UNCHECKED_CAST") // The cast happens after we filter by type so it's safe
inline fun <reified R> Flowable<*>.filterIsInstance(): Flowable<R> =
filter { it is R }
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
@Pulimet
Pulimet / AdbCommands
Last active September 20, 2024 06:31
Adb useful commands list
Hi All!
I've recently launched a tool that wraps many of the commands here with a user interface. This desktop application is currently available for macOS. There's a roadmap outlining planned features for the near future.
Feel free to request any features you'd like to see, and I'll prioritize them accordingly.
One of the most important aspects of this application is that every command executed behind the scenes is displayed in a special log section. This allows you to see exactly what’s happening and learn from it.
Here's the link to the repository: https://github.com/Pulimet/ADBugger
App Description:
ADBugger is a desktop tool designed for debugging and QA of Android devices and emulators. It simplifies testing, debugging, and performance analysis by offering device management, automated testing, log analysis, and remote control capabilities. This ensures smooth app performance across various setups.
task incrementVersion << {
def propsFile = file("../gradle.properties")
def propsText = propsFile.getText()
def patternVersionNumber = Pattern.compile("app_version=(\\d+)\\.(\\d+)\\.(\\d+)")
def matcherVersionNumber = patternVersionNumber.matcher(propsText)
matcherVersionNumber.find()
def majorVersion = Integer.parseInt(matcherVersionNumber.group(1))
def minorVersion = Integer.parseInt(matcherVersionNumber.group(2))
machine:
environment:
TERM: "dumb"
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx5120m -XX:+HeapDumpOnOutOfMemoryError"'
ANDROID_HOME: /usr/local/android-sdk-linux
java:
version:
oraclejdk8
dependencies:
pre:
@paolorotolo
paolorotolo / RealmBackupRestore.java
Last active June 17, 2018 17:31
Class to easily backup/restore data from Realm.
package org.glucosio.android.tools;
import android.Manifest;
import android.app.Activity;
import android.content.pm.PackageManager;
import android.os.Environment;
import android.support.v4.app.ActivityCompat;
import android.util.Log;
import android.widget.Toast;
@joar
joar / jq-insert-var.sh
Last active July 25, 2024 00:55
Add a field to an object with JQ
# Add field
echo '{"hello": "world"}' | jq --arg foo bar '. + {foo: $foo}'
# {
# "hello": "world",
# "foo": "bar"
# }
# Override field value
echo '{"hello": "world"}' | jq --arg foo bar '. + {hello: $foo}'
{
@koesie10
koesie10 / ApiModule.java
Created October 3, 2015 07:40
Retrofit 1 error handling behaviour in Retrofit 2
// Dagger 1 example
@Module(
complete = false,
library = true
)
public final class ApiModule {
@Provides
@Singleton
Retrofit provideRetrofit(Gson gson, Application app) {
return new Retrofit.Builder()
@nesquena
nesquena / ItemClickSupport.java
Last active September 17, 2024 18:57
Click handling for RecyclerView
/*
Source: http://www.littlerobots.nl/blog/Handle-Android-RecyclerView-Clicks/
USAGE:
ItemClickSupport.addTo(mRecyclerView).setOnItemClickListener(new ItemClickSupport.OnItemClickListener() {
@Override
public void onItemClicked(RecyclerView recyclerView, int position, View v) {
// do it
}
});