git remote -v
# View existing remotes
git remote set-url origin https://github.com/user/repo2.git
# Change the 'origin' remote's URL
git remote add origin https://github.com/user/repo2.git
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
#!/usr/bin/env bash | |
# If you dont know what happened just start this script for automatically trying solve your problem. | |
# Clear all your build folders and dependencies. | |
# Install dependencies again | |
platform=$1 | |
platform=$(echo "$platform" | tr '[:upper:]' '[:lower:]') # to lower string | |
echo "Moving to the root project folder" |
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 kotlin.collections.* | |
import org.reactivestreams.* | |
import kotlinx.coroutines.channels.* | |
import kotlinx.coroutines.reactive.* | |
import kotlinx.coroutines.* | |
import kotlin.coroutines.* | |
@ExperimentalCoroutinesApi | |
fun <T, U> Publisher<T>.debounce(timeout: Long, ctx: CoroutineContext) = GlobalScope.publish(ctx) { | |
var idx = 0; |
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 TextView.onTextChanged(handler: (text: CharSequence) -> Unit): TextWatcher { | |
val watcher = object : TextWatcher { | |
override fun afterTextChanged(editable: Editable?) { | |
} | |
override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) { | |
} | |
override fun onTextChanged(text: CharSequence?, p1: Int, p2: Int, p3: Int) { |
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
editSearch.addTextChangedListener(object : TextWatcher { | |
override fun afterTextChanged(editable: Editable?) { | |
} | |
override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) { | |
} | |
override fun onTextChanged(charSequence: CharSequence?, p1: Int, p2: Int, p3: Int) { | |
val text = charSequence?.toString() ?: "" |
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
@TargetApi(Build.VERSION_CODES.M) | |
fun Window.setLightStatusBar(light: Boolean) { | |
var flags = decorView.systemUiVisibility | |
if (light && (flags and View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR == View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR)) { | |
return | |
} else if (!light && (flags and View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR) != View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR) { | |
return | |
} |
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 kotlin.math.abs | |
/** | |
* @since 2018 | |
* @author Anton Vlasov - whalemare | |
*/ | |
object ImageUtils { | |
/** | |
* Choose prefer image size by map entry set. | |
* @param height your avatar holder height in px |
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
/** | |
* Helper in work with custom attributes on some widget | |
* <p> | |
* Just pass to this attributeSet from your widget constructor and {@link StyleableRes} | |
* | |
* @author Anton Vlasov - whalemare | |
* @since 2017 | |
*/ | |
public class AttrsDelegate { |
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
/** | |
* Add event to calendars using pretty api | |
* @since 2018 | |
* @author Anton Vlasov - whalemare | |
*/ | |
class CalendarEventDelegate { | |
var title = "" | |
var description = "" | |
var startMillis = Long.MIN_VALUE |
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
class TimberLinkingTree : Timber.Tree() { | |
private val CALL_STACK_INDEX = 4 | |
private val ANONYMOUS_CLASS = Pattern.compile("(\\$\\d+)+$") | |
override fun log(priority: Int, tag: String, message: String, t: Throwable) { | |
val stackTrace = Throwable().stackTrace | |
if (stackTrace.size <= CALL_STACK_INDEX) { | |
throw IllegalStateException( | |
"Synthetic stacktrace didn't have enough elements: are you using proguard?") | |
} |