Skip to content

Instantly share code, notes, and snippets.

View adityaladwa's full-sized avatar

Aditya Ladwa adityaladwa

View GitHub Profile
@adityaladwa
adityaladwa / cursor.md
Last active July 21, 2025 14:58
Cursor 101
  • Theme setup
  • cursor CLI launcher
  • Keybinding as per your previous editor
  • create account for enhanced support
  • Codebase indexing is the foundation to AI suggestion
    • the more cursor knows about you codebase the better it can give you suggestions
  • Tab, In-line edit and Agent
    • Tab can autocomplete blocks of code
    • CMD + K to open in-line edit box where you can ask what to code using natural language
    • CMD + I to open agent chat
@adityaladwa
adityaladwa / keybase.md
Created March 3, 2019 11:35
keybase.md

Keybase proof

I hereby claim:

  • I am ladwaaditya on github.
  • I am adi7ya (https://keybase.io/adi7ya) on keybase.
  • I have a public key ASA1clHNjrtj9NeZe_a5iO32Uv-VyAJLt_1OHTHTim4ixwo

To claim this, I am signing this object:

@adityaladwa
adityaladwa / RxSchedulerExtensionForJunit5.kt
Last active June 25, 2020 10:32
RxJava Scheduler Override rule for Junit5
package com.ladwa.aditya
import io.reactivex.Scheduler
import io.reactivex.android.plugins.RxAndroidPlugins
import io.reactivex.plugins.RxJavaPlugins
import io.reactivex.schedulers.Schedulers
import org.junit.jupiter.api.extension.AfterEachCallback
import org.junit.jupiter.api.extension.BeforeEachCallback
import org.junit.jupiter.api.extension.ExtensionContext
import java.util.concurrent.Callable
val okhttpClientBuilder = OkHttpClient.Builder()
val networkInterceptor = NetworkInterceptor(context)
okhttpClientBuilder.addInterceptor(networkInterceptor)
val okhttpClient = okhttpClientBuilder.build()
viewModel.login()
.subscribeWith(new DisposableSingleObserver<Result>() {
@Override
public void onSuccess(Result result) {
//Handle Success
}
@Override
public void onError(Throwable e) {
if (e instanceof NetworkInterceptor.NoNetworkException) {
@adityaladwa
adityaladwa / NetworkInterceptor.kt
Last active November 20, 2020 09:57
An okhttp interceptor to check internet connection before making a http request
class NetworkInterceptor(context: Context) : Interceptor {
private val mApplicationContext: Context = context.applicationContext
private val isConnected: Boolean
get() {
val cm = mApplicationContext.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
val activeNetwork = cm.activeNetworkInfo
return activeNetwork != null && activeNetwork.isConnectedOrConnecting
}
@adityaladwa
adityaladwa / build.gradle
Created February 26, 2017 13:39 — forked from IliaEremin/build.gradle
Example of managing dependencies in separate file
apply from: 'deps.gradle'
// ...
dependencies {
compile supportLibs
compile rxJavaLibs
compile retrofitLibs
compile okHttpLibs
public void onClickReference(User user) {
Toast.makeText(this.context, "Clicked Listener method " + user.getFirstName() + user.getLastName(), Toast.LENGTH_SHORT).show();
user.setClicked(user.isClicked());
}
public class User extends BaseObservable {
private boolean clicked;
@Bindable public boolean isClicked() {
return clicked;
}
public void setClicked(boolean clicked) {
this.clicked = !clicked;
User user = new User("Aditya", "Ladwa", 22, true);