Skip to content

Instantly share code, notes, and snippets.

Ali Yusuf AliYusuf95

Block or report user

Report or block AliYusuf95

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@AliYusuf95
AliYusuf95 / interfaces.mongo-options.interface.ts
Created Sep 8, 2019
MongoDB driver module for NestJS with dynamic mongo connection creation per request and handling open connections
View interfaces.mongo-options.interface.ts
import { ModuleMetadata, Type } from '@nestjs/common/interfaces'
/**
* Options that ultimately need to be provided to create a MongoDB connection
*/
export interface MongoModuleOptions {
connectionName?: string
uri: string
dbName: string
clientOptions?: any
View DeviceUtils.java
import android.annotation.SuppressLint;
import android.app.ActivityManager;
import android.content.Context;
import android.content.res.Configuration;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.provider.Settings;
import android.support.annotation.IntDef;
import android.telephony.TelephonyManager;
@AliYusuf95
AliYusuf95 / RxBus.java
Last active May 7, 2017
RxJava event bus implementation with subscribing and unsubscribing.
View RxBus.java
import android.support.annotation.NonNull;
import java.util.HashMap;
import java.util.Map;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer;
import io.reactivex.functions.Predicate;
import io.reactivex.subjects.PublishSubject;
@AliYusuf95
AliYusuf95 / OnEventListener.java
Last active Jan 26, 2020
Websocket implementation using OkHttp3 with {event->data} message format to make your life easier.
View OnEventListener.java
public interface OnEventListener {
/**
* Invoked when new message received from websocket with {event, data} structure
*
* @param data Data string received
*/
void onMessage(String data);
}
You can’t perform that action at this time.