Skip to content

Instantly share code, notes, and snippets.

:shipit:
Working

Luan Gabriel da Silva luangs7

:shipit:
Working
  • Curitiba, Brazil
Block or report user

Report or block luangs7

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
View FixAppBarLayoutBehavior.java
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@luangs7
luangs7 / GuardLetKotlinExtension.kt
Last active Aug 15, 2018
An example of creating a Swift like guard let extension function in Kotlin with rule validation
View GuardLetKotlinExtension.kt
inline infix fun EditText.guard(rule:Boolean,call: () -> Unit): String? {
if (this.text.isNotEmpty() && rule) return text
else {
call()
return null
}
}
fun String.isEmail(): Boolean {
val p = "^(\\w)+(\\.\\w+)*@(\\w)+((\\.\\w+)+)\$".toRegex()
@luangs7
luangs7 / GuardLetEditTextExtension.kt
Last active Jul 17, 2018
An example of creating a Swift like guard let extension function in Kotlin for EditText viewgroup
View GuardLetEditTextExtension.kt
inline infix fun EditText.guard(call: () -> Unit): String? {
if (this.text.isNotEmpty()) return text
else {
call()
return null
}
}
//example of usage
You can’t perform that action at this time.