Skip to content

Instantly share code, notes, and snippets.

View kakai248's full-sized avatar

Ricardo Carrapiço kakai248

View GitHub Profile
public class ViewModelInjectionFactory<VM extends ViewModel> implements ViewModelProvider.Factory {
private Lazy<VM> viewModel;
@Inject
public ViewModelInjectionFactory(Lazy<VM> viewModel) {
this.viewModel = viewModel;
}
@Override
import java.util.concurrent.TimeUnit;
import io.reactivex.ObservableOperator;
import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;
public class FilterWithTimeout<T> implements ObservableOperator<T, T> {
private final long intervalDuration;
private final TimeUnit unit;
package me.mesmo.app.presentation.views;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.support.annotation.ColorInt;
import android.support.annotation.Nullable;
import android.support.v7.widget.AppCompatTextView;
import android.text.Layout;
public class ResourceProvider {
private final Context context;
@Inject
public ResourceProvider(Context context) {
this.context = context;
}
@NonNull
private TimedCacheSource<Discover> discoverObservable = TimedCacheSource.createWithTimeout(30, TimeUnit.SECONDS);
public Single<Discover> getProviders() {
return discoverObservable.switchIfEmpty(fetchProviders().doOnSuccess(discoverObservable));
}
package me.mesmo.app.utils.cache;
import com.jakewharton.rxrelay2.PublishRelay;
import com.jakewharton.rxrelay2.Relay;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import io.reactivex.Completable;
import io.reactivex.Observable;
@kakai248
kakai248 / Consumer.java
Created March 12, 2018 18:43
SpanBuilder
public interface Consumer<T> {
void accept(T value);
}
@Module
abstract class FragmentBindingModule {
@Binds
abstract fun bindFragmentFactory(factory: FragmentInjectionFactory): FragmentFactory
@Binds
@IntoMap
@FragmentKey(MainFragment::class)
abstract fun bindMainFragment(fragment: MainFragment): Fragment
import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
import android.content.res.ColorStateList
import android.content.res.Resources
import android.graphics.Typeface
import android.graphics.drawable.Drawable
import android.view.View
import android.view.animation.Animation
import android.view.animation.AnimationUtils
const puppeteerLottie = require("puppeteer-lottie");
const fs = require("fs");
const baseInputDir = "lotties/";
const baseOutputDir = "lotties-rendered/";
const outputExtension = '.mp4';
(async () => {
await run();