Author: Michael Zeng
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 React from 'react' | |
| import PropTypes from 'prop-types' | |
| import { Formik } from 'formik' | |
| import Dialog, { | |
| DialogActions, | |
| DialogContent, | |
| DialogContentText, | |
| DialogTitle | |
| } from 'material-ui/Dialog' | |
| import Button from 'material-ui/Button' |
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 Route.coHandler(controller: suspend RoutingContext.() -> ServerResponse): Route = | |
| handler { | |
| launch(it.vertx().dispatcher()) { | |
| val response = it.controller() | |
| when (response) { | |
| is ServerResponse.Empty -> | |
| it.response().end() | |
| is ServerResponse.Json -> |
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
| @ContextDsl | |
| fun Route.coGet(path: String, block: suspend ApplicationCall.() -> ServerResponse): Route = get("/") { | |
| val result = call.block() | |
| when (result) { | |
| is ServerResponse.Empty -> | |
| call.respondText { "" } | |
| is ServerResponse.Json -> | |
| call.respondText(result.jsonString, ContentType.Application.Json) |
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 | |
| # I've found that the "Migrate to AndroidX" converter in Android Studio doesn't work very | |
| # well, so I wrote my own script to do the simple job of converting package names. | |
| # | |
| # You can download a CSV of package names here: https://developer.android.com/topic/libraries/support-library/downloads/androidx-class-mapping.csv | |
| # | |
| # It'll run faster on a clean build because then there are fewer files to scan over. | |
| # | |
| # Uses `gsed` because I'm on a Mac. Can easily replace with `sed` if you don't have `gsed`. |
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 kotlinx.coroutines.experimental.android.Main | |
| import kotlinx.coroutines.experimental.CoroutineScope | |
| class ExampleActivity : Activity(), CoroutineScope by CoroutineScope(Dispatchers.Main) { | |
| override fun onCreate(savedInstanceState: Bundle?) | |
| super.onCreate(savedInstanceState) | |
| val ui = Ui(this) // bind views, etc | |
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
| /** | |
| * We are combining unit and intrumentation test reports | |
| * if no one uses instrumentation then delete createDebugCoverageReport | |
| * and it output outputs/code-coverage/connected/*coverage.ec | |
| */ | |
| /** | |
| * Since jacoco does not support android out of the box we create a custom task per variant | |
| * for test coverage.All the coverage reports are created in the root projects build directory. | |
| * These are then archived in the pages folder which is then deployed on the project. |
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
| // https://github.com/Zhuinden/fragmentviewbindingdelegate-kt | |
| import android.view.View | |
| import androidx.fragment.app.Fragment | |
| import androidx.lifecycle.DefaultLifecycleObserver | |
| import androidx.lifecycle.Lifecycle | |
| import androidx.lifecycle.LifecycleOwner | |
| import androidx.lifecycle.Observer | |
| import androidx.viewbinding.ViewBinding | |
| import kotlin.properties.ReadOnlyProperty |
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
| /** | |
| * Navigates only if this is safely possible; when this Fragment is still the current destination. | |
| */ | |
| fun Fragment.navigateSafe( | |
| @IdRes resId: Int, | |
| args: Bundle? = null, | |
| navOptions: NavOptions? = null, | |
| navigatorExtras: Navigator.Extras? = null | |
| ) { | |
| if (mayNavigate()) findNavController().navigate( |
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
| require 'optimist' | |
| require 'plist' | |
| # Setups of source path mapping for the framework at framework_path, | |
| # which has a dsym at dsym_path. It maps the source paths to the | |
| # source_path root. Implementation borrowed from https://medium.com/@maxraskin/background-1b4b6a9c65be | |
| def setup_dsym_source_mapping(framework_path, dsym_path, source_path) | |
| binary_uuids = get_uuids_of_dwarf(framework_path) | |
| dsym_uuids = get_uuids_of_dwarf(dsym_path) | |
| verify_uuids(binary_uuids, dsym_uuids) |