The truth about Google's famous '20% time' policy
Why coders get into 'religious wars' over programming languages
Is It Worth the Time?
Moving from GitHub to Bitbucket
Webhook
How good are Git Hooks?
Frontend VS Backend
Waiting In Line To See Star Wars: 1977-2000
Fascinating facts about how we spend the days of our lives
Why Does the Other Line Always Move Faster?: The Myths and Misery, Secrets and Psychology of Waiting in Line
Taming of the Queue
New Research on the Theory of Waiting Lines (Queues), Including the Psychology of Queuing
Why the Java Stack class is bad
How Long People Waited to Be First in Line to Buy Apple Products
[iPhone X: Thousands of Apple
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.graphics.Rect | |
import android.support.v7.widget.RecyclerView | |
import android.view.View | |
class GridSpacingItemDecoration(private val spanCount: Int, private val spacing: Int, private val includeEdge: Boolean) : RecyclerView.ItemDecoration() { | |
override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, state: RecyclerView.State) { | |
val position = parent.getChildAdapterPosition(view) // item position | |
val column = position % spanCount // item column |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class BindableAdapter<TYPE : MultiType>(private val list: MutableList<TYPE>) : RecyclerView.Adapter<BindableViewHolder<TYPE>>() { | |
override fun onBindViewHolder( | |
holder: BindableViewHolder<TYPE>, | |
position: Int | |
) = holder.bind(list[position]) | |
override fun getItemViewType(position: Int): Int = list[position].type | |
override fun getItemCount(): Int = list.size | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val world = "World" | |
val spannedText = SpannableString("Hello $world!") | |
spannedText | |
.spanWith(world) { | |
what = BackgroundColorSpan(Color.RED) | |
flags = Spanned.SPAN_EXCLUSIVE_EXCLUSIVE | |
} | |
.spanWith(world) { | |
what = StyleSpan(Typeface.BOLD) | |
flags = Spanned.SPAN_EXCLUSIVE_EXCLUSIVE |