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 my.androidapp | |
import my.androidapp.models | |
suspend fun getSpaceX(limit:Int) { | |
val vLimit = "\$limit" | |
val query = """ | |
query($vLimit:Int) | |
{ | |
launchesPast(limit: $vLimit) { | |
mission_name |
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
package my.androidapp | |
import okhttp3.* | |
import okhttp3.MediaType.Companion.toMediaTypeOrNull | |
import okhttp3.RequestBody.Companion.toRequestBody | |
import okio.IOException | |
import org.json.JSONObject | |
import kotlin.coroutines.resume | |
import kotlin.coroutines.resumeWithException | |
import kotlin.coroutines.suspendCoroutine |
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
// To parse the JSON, install Klaxon and do: | |
// | |
// val spaceX = SpaceX.fromJson(jsonString) | |
package my.androidapp.models | |
import com.beust.klaxon.* | |
private val klaxon = Klaxon() |
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
query($limit:Int) | |
{ | |
launchesPast(limit: $limit) { | |
mission_name | |
launch_date_local | |
launch_site { | |
site_name_long | |
} | |
links { | |
article_link |
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
// 定义 | |
export interface MyInputHandles { | |
focus(): void; | |
} | |
const MyInput: RefForwardingComponent<MyInputHandles, MyInputProps> = ( | |
props, | |
ref | |
) => { | |
const inputRef = useRef<HTMLInputElement>(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
//Other using import statements | |
//We only import 2 packages | |
using Azure.Security.KeyVault.Secrets; | |
using Azure.Identity; | |
//Other codes remain unchanged | |
//Only changes to be made are in this method ConfigureServices() | |
public void ConfigureServices(IServiceCollection services) | |
{ |
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
const express = require('express') | |
const app = express() | |
const port = process.env.PORT || 3000 | |
app.get('/', (req, res) => { | |
res.send('Hello World!') | |
}) | |
const { DefaultAzureCredential } = require('@azure/identity') | |
const credentials = new DefaultAzureCredential() |
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
// To parse this data: | |
// | |
// import { Convert, User } from "./file"; | |
// | |
// const user = Convert.toUser(json); | |
// | |
// These functions will throw an error if the JSON doesn't | |
// match the expected interface, even if the JSON is valid. | |
export interface User { |
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
using Xamarin.Forms; | |
using System.ComponentModel; | |
using System.Threading.Tasks; | |
namespace AsyncButtonApp.ViewModels | |
{ | |
public class MainPageViewModel : INotifyPropertyChanged | |
{ | |
public event PropertyChangedEventHandler PropertyChanged; | |
protected virtual void OnPropertyChanged(string propertyName) | |
{ |
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
<?xml version="1.0" encoding="utf-8" ?> | |
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" | |
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | |
xmlns:components="clr-namespace:AsyncButtonApp.Components" | |
xmlns:vm="clr-namespace:AsyncButtonApp.ViewModels" | |
x:Class="AsyncButtonApp.Views.MainPage" | |
Title="Main Page"> | |
<ContentPage.BindingContext> | |
<vm:MainPageViewModel /> | |
</ContentPage.BindingContext> |