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 python | |
import sys, re | |
from subprocess import check_output | |
commit_msg_filepath = sys.argv[1] | |
branch = check_output(['git', 'symbolic-ref', '--short', 'HEAD']).strip() | |
regex = '(STRY.\d+)' | |
if re.search(regex, branch): | |
issue = re.search(regex, branch).group() |
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
enum class ScreenState { | |
LOADING, | |
ERROR, | |
SUCCESS | |
} | |
class Response(val state: ScreenState, val data: String?, val error: Throwable?) | |
fun main(args: Array<String>) { |
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
open class ScreenState2 { | |
object LoadingState : ScreenState2() | |
class ErrorState(val error: Throwable) : ScreenState2() | |
class SuccessState(val data: String) : ScreenState2() | |
} | |
fun main(args: Array<String>) { | |
val response2: ScreenState2 = ScreenState2.SuccessState("yay") |
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
sealed class ScreenState3 { | |
object LoadingState : ScreenState3() | |
class ErrorState(val error: Throwable) : ScreenState3() | |
class SuccessState(val data: String) : ScreenState3() | |
} | |
fun main(args: Array<String>) { | |
val response3: ScreenState3 = ScreenState3.SuccessState("yay") |
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
ndk { | |
abiFilters "armeabi-v7a", "x86", "arm64-v8a", "x86_64" | |
} |
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
suspend fun refreshTitle() { | |
// interact with *blocking* network and IO calls from a coroutine | |
withContext(Dispatchers.IO) { | |
val result = try { | |
// Make network request using a blocking call | |
network.fetchNextTitle().execute() | |
} catch (cause: Throwable) { | |
// If the network throws an exception, inform the caller | |
throw TitleRefreshError("Unable to refresh title", cause) | |
} |
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
suspend fun refreshTitle() { | |
// interact with *blocking* network and IO calls from a coroutine | |
withContext(Dispatchers.IO) { | |
val result = try { | |
// Make network request using a blocking call | |
network.fetchNextTitle().execute() | |
} catch (cause: Throwable) { | |
// If the network throws an exception, inform the caller | |
throw TitleRefreshError("Unable to refresh title", cause) | |
} |
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
suspend fun refreshTitle() { | |
try { | |
// Make network request using a blocking call | |
val result = network.fetchNextTitle() | |
titleDao.insertTitle(Title(result)) | |
} catch (cause: Throwable) { | |
// If anything throws an exception, inform the caller | |
throw TitleRefreshError("Unable to refresh title", cause) | |
} | |
} |
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 AuthService { | |
final FirebaseAuth _auth = FirebaseAuth.instance; | |
final GoogleSignIn _googleSignIn = GoogleSignIn(); | |
Stream<User> get user { | |
return _auth.onAuthStateChanged.map(_userFromFirebaseUser); | |
} | |
User _userFromFirebaseUser(FirebaseUser user) { | |
return user != null ? User(id: user.uid, name: user.displayName, email: user.email) : null; |
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
// Reads "One" -> "Two" -> "Three" | |
Row(modifier = Modifier.semantics(mergeDescendants = false) { }) { | |
Text("One") | |
Column { | |
Text("Two") | |
Text("Three") | |
} | |
} | |
// Reads "One Two Three" |