-
gst
:git status
-
gc
:git commit -v
-
gc!
:git commit -v --amend
-
gcn!
:git commit -v --no-edit --amend
-
ggu <branch>
:git pull --rebase origin <branch>
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
# ignore Robolectric jar dependencies | |
#Robolectric jars for unit tests | |
/robolectric/*.jar |
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
fun <T> RecyclerView.Adapter<*>.autoNotify( | |
oldList: List<T>, | |
newList: List<T>, | |
compare: (old: T, new: T) -> Boolean | |
) { | |
val diff = DiffUtil.calculateDiff(object : DiffUtil.Callback() { | |
override fun areItemsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean { | |
return compare(oldList[oldItemPosition], newList[newItemPosition]) | |
} |
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
# 1- Enable git plugin -> plugins=( git ) | |
# 2- Add these lines in your .zshrc file | |
# 3- Edit your reviewers in gerrit_reviewers() function below | |
# 4- Run `gpr <branch_name>` to push, `gpr! <branch_name>` to push as Draft | |
# Aliases For gerrit | |
function gerrit_reviewers() { | |
echo "%[email protected],[email protected],[email protected]" | |
} |
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
inline fun <T : Exception> logException(exception: () -> T) { | |
// check if you have any precondition to report exception, | |
// for instance, is it in production? | |
if (isProductionBlaBla()) { | |
try { | |
// exception() will return a subclass of exception, so throw it | |
throw exception() | |
} catch (e: Exception) { | |
// catch exception and report it | |
CrashReportUtil.report(e) |
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
//initiate Player | |
//Create a default TrackSelector | |
BandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(); | |
TrackSelection.Factory videoTrackSelectionFactory = new AdaptiveTrackSelection.Factory(bandwidthMeter); | |
TrackSelector trackSelector = new DefaultTrackSelector(videoTrackSelectionFactory); | |
//Create the player | |
SimpleExoPlayer player = ExoPlayerFactory.newSimpleInstance(this, trackSelector); | |
SimpleExoPlayerView simpleExoPlayerView = (SimpleExoPlayerView) findViewById(R.id.simple_player); | |
simpleExoPlayerView.setPlayer(player); |
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.app.Fragment | |
import android.content.Context | |
import android.net.Uri | |
import android.support.customtabs.CustomTabsIntent | |
import android.support.v4.content.ContextCompat | |
import android.support.v4.app.Fragment as SupportFragment | |
fun Context.customTab(url: String, init: (CustomTabsIntent.Builder.() -> Unit)? = null) { | |
val customTabBuilder = CustomTabsIntent.Builder() |
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.widget.ImageView | |
fun com.squareup.picasso.RequestCreator.into(target: ImageView, func: __Callback.() -> Unit) { | |
val callback = __Callback() | |
callback.func() | |
into(target, callback) | |
} | |
class __Callback : com.squareup.picasso.Callback { |
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
@file:JvmName("PermissionExtensions") | |
import android.app.Activity | |
import android.content.pm.PackageManager | |
import android.support.v4.app.ActivityCompat | |
import android.support.v4.content.ContextCompat | |
/** | |
* Invoke [onGranted] if permission is granted. Otherwise, request permission. | |
* |
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
fun _RecyclerView.defaultDivider() { | |
addItemDecoration(DividerItemDecoration(context, LinearLayout.VERTICAL)) | |
} |
NewerOlder