Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

sembozdemir sembozdemir

🏠
Working from home
Block or report user

Report or block sembozdemir

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sembozdemir
sembozdemir / zsh-git-cheatsheet.md
Last active Dec 25, 2018
My ZSH git aliases that I use mostly
View zsh-git-cheatsheet.md
  • 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>

@sembozdemir
sembozdemir / .zshrc
Last active Dec 6, 2018
Gerrit push aliases for ZSH
View .zshrc
# 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 "%r=a@a.com,r=b@b.com,r=c@c.com"
}
View logException.kt
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)
@sembozdemir
sembozdemir / PlayerActivity.java
Created Apr 11, 2018 — forked from PonnamKarthik/PlayerActivity.java
RTMP Player using Exo Media Player Library
View PlayerActivity.java
//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);
@sembozdemir
sembozdemir / CustomTabs.kt
Created Dec 19, 2017
CustomTabs (android.support.customtabs) extensions for Kotlin
View CustomTabs.kt
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()
View Picassos.kt
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 {
View Permissions.kt
@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.
*
@sembozdemir
sembozdemir / ViewExtensions.kt
Created Nov 15, 2016
ToDoKotlin - ViewExtensions.kt (only defaultDivider())
View ViewExtensions.kt
fun _RecyclerView.defaultDivider() {
addItemDecoration(DividerItemDecoration(context, LinearLayout.VERTICAL))
}
@sembozdemir
sembozdemir / MainActivity.kt
Created Nov 15, 2016
TodoKotlin - MainActivity.kt (after extracting UI code)
View MainActivity.kt
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
MainActivityUI(TodoListAdapter()).setContentView(this)
}
}
@sembozdemir
sembozdemir / MainActivityUI.kt
Created Nov 15, 2016
ToDoKotlin - MainActivityUI.kt
View MainActivityUI.kt
class MainActivityUI(val todoListAdapter: TodoListAdapter) : AnkoComponent<MainActivity> {
override fun createView(ui: AnkoContext<MainActivity>) = with(ui) {
verticalLayout {
recyclerView {
val orientation = LinearLayoutManager.VERTICAL
layoutManager = LinearLayoutManager(ctx, orientation, false)
addItemDecoration(DividerItemDecoration(ctx, LinearLayout.VERTICAL))
adapter = todoListAdapter
}.lparams(width = matchParent,
You can’t perform that action at this time.