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
| def get_str_of_intervals(arr: []) -> str: | |
| if not arr: | |
| return '' | |
| breaks = [] | |
| arr.sort() | |
| start = end = arr[0] | |
| for i in arr[1:]: | |
| diff = i - end | |
| if diff == 1: | |
| end = i |
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:convert'; | |
| import 'package:flutter/material.dart'; | |
| import 'package:flutter/services.dart'; | |
| const appSupportedLocales = <Locale>[ | |
| Locale('ru'), | |
| Locale('en'), | |
| ]; |
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
| syntax="proto3"; | |
| message Student { | |
| int32 id = 1; | |
| string name = 2; | |
| } | |
| message Question { | |
| int32 id = 1; | |
| string text = 2; |
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:math'; | |
| import 'package:grpc/src/server/call.dart'; | |
| import 'package:grpc/grpc.dart' as grpc; | |
| import 'package:umka/questions_db_driver.dart'; | |
| import 'generated/umka.pbgrpc.dart'; | |
| class UmkaService extends UmkaServiceBase { |
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:io'; | |
| import 'package:grpc/grpc.dart'; | |
| import 'generated/umka.pbgrpc.dart'; | |
| class UmkaTerminalClient { | |
| late final ClientChannel channel; | |
| late final UmkaClient stub; |
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
| /// copyright 2020, roipeker | |
| class FormValidations { | |
| static String email(String val) { | |
| val = val.trim(); | |
| if (val.isEmpty) return 'Email cant be empty'; | |
| if (val.length <= 4) return 'Email is too short'; | |
| if (!val.isEmail) return 'Invalid email'; | |
| return 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
| void main() async { | |
| Future.delayed(Duration(milliseconds: 500)).then((_) { | |
| print('hi'); | |
| }); | |
| print('hello'); | |
| await Future.delayed(Duration(milliseconds: 1000)); | |
| print('hi'); |
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
| extension Normalize on num { | |
| num normalized( | |
| num selfRangeMin, | |
| num selfRangeMax, [ | |
| num normalizedRangeMin = 0.0, | |
| num normalizedRangeMax = 1.0, | |
| ]) => | |
| (normalizedRangeMax - normalizedRangeMin) * | |
| ((this - selfRangeMin) / (selfRangeMax - selfRangeMin)) + | |
| normalizedRangeMin; |
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
| extension CompactMap<T> on Iterable<T?> { | |
| Iterable<T> compactMap<E>([E? Function(T?)? transform]) => | |
| map(transform ?? (e) => e).where((e) => e != null).cast(); | |
| } |
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
| { | |
| "Flutter App Example Scaffold": { | |
| "scope": "dart", | |
| "prefix": "fsapp", | |
| "body": [ | |
| "import 'package:flutter/material.dart';", | |
| "", | |
| "void main() {", | |
| " runApp(MaterialApp(", | |
| "title: 'Flutter Demo',", |