Skip to content

Instantly share code, notes, and snippets.

View Firsto's full-sized avatar
☄️
I may be slow to respond.

Roman Zaostrovsky Firsto

☄️
I may be slow to respond.
View GitHub Profile
@Firsto
Firsto / Gauss elimination
Created September 13, 2015 16:43
gauss elimination
import java.util.Scanner;
public class Main{
public static void main(String []args){
Scanner sc = new Scanner(System.in);
String mn = sc.nextLine();

Keybase proof

I hereby claim:

  • I am firsto on github.
  • I am first (https://keybase.io/first) on keybase.
  • I have a public key ASDgkfUCx3tCc1M5DXoKMaPMOHsKSTFFn_FQvxeZPkE4ZQo

To claim this, I am signing this object:

@Firsto
Firsto / AwesomeUniversalUltimatePhoneTextWatcher.java
Created March 23, 2017 06:30
textwatcher to format russian phone numbers like +7 800 555 4444
package ru.firsto.testtesttest.ui.activity.auth;
import android.text.Editable;
import android.text.TextWatcher;
/**
* @author razor
* @created 23.03.17
**/
@Firsto
Firsto / BuildingInfoActivity.java
Created April 18, 2017 04:30
Endless-like loop fast adapter
class BuildingImageAdapter extends FastItemAdapter<BuildingImageItem> {
@Override
public int getAdapterItemCount() {
return Integer.MAX_VALUE;
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
position = position % getItemAdapter().getAdapterItems().size();
super.onBindViewHolder(holder, position);
import com.arellomobile.mvp.MvpPresenter;
import com.arellomobile.mvp.MvpView;
import gb.sweetlifecl.di.module.SchedulerProvider;
import rx.Completable;
import rx.Observable;
import rx.Single;
import rx.Subscription;
public abstract class RxPresenter<V extends MvpView> extends MvpPresenter<V> {
import rx.Scheduler;
public class SchedulerProvider {
private final Scheduler subscribeOn;
private final Scheduler observeOn;
public SchedulerProvider(Scheduler subscribeOn, Scheduler observeOn) {
this.subscribeOn = subscribeOn;
this.observeOn = observeOn;
import com.google.gson.JsonArray;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Collections;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import gb.sweetlifecl.R;
public class OrderListDividerDecorator extends RecyclerView.ItemDecoration {
@Firsto
Firsto / grayscale_imageview.java
Created November 6, 2017 12:03 — forked from nisrulz/grayscale_imageview.java
Apply grayscale filter to ImageView in android
ImageView imgview = (ImageView)findViewById(R.id.imageView_grayscale);
imgview.setImageBitmap(bitmap);
// Apply grayscale filter
ColorMatrix matrix = new ColorMatrix();
matrix.setSaturation(0);
ColorMatrixColorFilter filter = new ColorMatrixColorFilter(matrix);
imgview.setColorFilter(filter);
@Firsto
Firsto / ScaleView.kt
Created January 29, 2020 15:06
SImple view to add scale bar in map container layout
import android.content.Context
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Paint
import android.graphics.Paint.Style.FILL
import android.graphics.Paint.Style.STROKE
import android.graphics.Path
import android.graphics.Rect
import android.util.AttributeSet
import android.view.View