Skip to content

Instantly share code, notes, and snippets.

View rizafu's full-sized avatar
🏠
Working from home

Riza Fathul Uzzy rizafu

🏠
Working from home
View GitHub Profile

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@rizafu
rizafu / BottomSheetBehaviorDialogFragment.kt
Created March 28, 2019 09:45
Android bottom sheet behavior in bottom sheet dialog fragment
abstract class BottomSheetBehaviorDialogFragment: BottomSheetDialogFragment(){
private var behavior: BottomSheetBehavior<View>? = null
abstract fun createContentView(): View
open fun getStateStart(): Int = BottomSheetBehavior.STATE_EXPANDED
open fun onSlide(bottomSheet: View, slideOffset: Float) = Unit
open fun onStateChanged(bottomSheet: View, newState: Int) = Unit
@rizafu
rizafu / SingleRecyclerView.kt
Last active December 21, 2022 16:00
Android Single Recycler View for multiple view type with ListAdapter and AsyncDifferConfig
interface ItemModel{
/**
* this function for rendering layout id to view holder
*/
@LayoutRes fun layoutId(): Int
/**
* this function for stable id in recyclerView
*/
fun id(): Long = hashCode().toLong()
@rizafu
rizafu / ReviewSlider.java
Last active May 25, 2019 06:10
Android Review Slider
public class ReviewSlider extends View {
private Paint paint = new Paint();
private Paint circleDefaultPaint = new Paint();
private Paint circleWhitePaint = new Paint();
private Paint selectedPaint = new Paint();
private int mNumOfCircle = 2;
private Bitmap mThumbImage = null;
private float mLineHeight;
private float mThumbRadius;
private float mCircleRadius;