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
| # This should be enabed by default - but just in case | |
| org.gradle.daemon=true | |
| # Most projects consist of multiple subprojects, some of which are independent. | |
| # By default, Gradle runs only one task at a time - this removes this restriction. | |
| org.gradle.parallel=true | |
| # Enables incubating configuration-on-demand, | |
| # where Gradle will attempt to configure only necessary projects. | |
| org.gradle.configureondemand=true |
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 buildHttpClient() = HttpClient(Okhttp){ | |
| val formatter = Json { | |
| prettyPrint = true | |
| isLenient = true | |
| ignoreUnknownKeys = true | |
| coerceInputValues = true | |
| } | |
| install(ContentNegotiation) { | |
| json(formatter) | |
| } |
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 android.content.res.Configuration | |
| import androidx.compose.runtime.Composable | |
| import androidx.compose.ui.tooling.preview.Preview | |
| import androidx.compose.ui.unit.dp | |
| import androidx.compose.ui.tooling.preview.Devices | |
| @Preview(showBackground = true) | |
| @Composable | |
| fun DefaultPreview() { | |
| MyScreen() |
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 re | |
| first_message_index = 4 | |
| step_index = 6 | |
| def get_first_alphabetic_character_pos(s): | |
| m = re.search(r'[a-z]', s, re.I) | |
| if m is not None: | |
| return m.start() | |
| return 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
| data class User(val id: String, val nickname: String) | |
| data class Message(val id: String, val message: String?, val user: User) | |
| val users = listOf( | |
| User("000", "Bender"), | |
| User("001", "Leela"), | |
| User("002", "Fry"), | |
| User("003", "Zoidberg") | |
| ) |
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
| data class User(val id: String, val nickname: String) | |
| data class Message(val id: String, val message: String?, val user: User) | |
| val users = listOf( | |
| User("000", "Bender"), | |
| User("001", "Leela"), | |
| User("002", "Fry"), | |
| User("003", "Zoidberg") | |
| ) |
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 'dart:async'; | |
| void main() async { | |
| final subscription = numberStreamWithController(8) | |
| .listen((event) => print("received $event")); | |
| await Future.delayed(Duration(seconds: 3)); | |
| print("idling for 2 seconds"); | |
| subscription.pause(); |
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 'package:flutter/material.dart'; | |
| void main() => runApp(MyApp()); | |
| class MyApp extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return MaterialApp( | |
| home: Scaffold(body: MyStatefulWidget()), | |
| ); |
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
| void main() { | |
| Future.delayed(Duration(seconds: 1), () => throw 'Boom!') | |
| .catchError( | |
| (e) => print('error we caught: $e'), | |
| ) | |
| .whenComplete(() => | |
| print('doing something regardless of what happened previously')); | |
| } |
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
| void main() async { | |
| try { | |
| await Future.delayed(Duration(seconds: 1), () => throw 'Boom!'); | |
| } catch (e) { | |
| print('error we caught: $e'); | |
| } finally { | |
| print('doing something regardless of what happened previously'); | |
| } | |
| } |
NewerOlder