Skip to content

Instantly share code, notes, and snippets.

View meg4cyberc4t's full-sized avatar

Igor Molchanov meg4cyberc4t

View GitHub Profile
@meg4cyberc4t
meg4cyberc4t / weight.dart
Last active February 14, 2024 22:23
A class for working with weight
final class Weight {
final int _grams;
const Weight.fromGrams(final int grams) : _grams = grams;
const Weight.fromKilograms(final int kilograms) : _grams = kilograms * 1000;
const Weight.fromOunces(final int ounces)
: _grams = ounces * ouncesPerGrams ~/ 1;
const Weight.fromPounds(final int pounds)
: _grams = pounds ~/ ouncesPerPounds * ouncesPerGrams ~/ 1;
const Weight.fromStones(final int stones)
@meg4cyberc4t
meg4cyberc4t / dart_eval_benchmark.dart
Last active April 22, 2024 15:59
Comparison of dart_eval execution with regular compiler execution
import 'package:benchmark_harness/benchmark_harness.dart';
import 'package:dart_eval/dart_eval.dart';
class EvalBenchmark extends BenchmarkBase {
EvalBenchmark() : super('EvalBenchmark');
@override
void run() {
const a = '''
for (int i = 0; i < 100; i++) {
{"name":"Python + Postgre","icon":"game","settings":"{\"settings\":\"{\\r\\n \\\"workbench.iconTheme\\\": \\\"material-icon-theme\\\",\\r\\n \\\"[dart]\\\": {\\r\\n \\\"editor.formatOnSave\\\": true,\\r\\n \\\"editor.formatOnType\\\": true,\\r\\n \\\"editor.rulers\\\": [80],\\r\\n \\\"editor.selectionHighlight\\\": false,\\r\\n \\\"editor.suggest.snippetsPreventQuickSuggestions\\\": false,\\r\\n \\\"editor.suggestSelection\\\": \\\"first\\\",\\r\\n \\\"editor.tabCompletion\\\": \\\"onlySnippets\\\",\\r\\n \\\"editor.wordBasedSuggestions\\\": \\\"off\\\"\\r\\n },\\r\\n \\\"redhat.telemetry.enabled\\\": true,\\r\\n \\\"dart.debugExternalPackageLibraries\\\": false,\\r\\n \\\"dart.debugSdkLibraries\\\": false,\\r\\n \\\"explorer.confirmDragAndDrop\\\": false,\\r\\n \\\"dart.showInspectorNotificationsForWidgetErrors\\\": false,\\r\\n \\\"editor.codeActionsOnSave\\\": {\\r\\n \\\"source.fixAll\\\": \\\"explicit\\\",\\r\\n \\\"source.organizeImports\\\": \\\"explicit\\\"\\r\\n
@meg4cyberc4t
meg4cyberc4t / example.dart
Last active May 25, 2024 12:37
Using labels for loops
/*
* Use labels for loops
* https://gist.github.com/meg4cyberc4t/4c639ec89dcc4d1e9e01c82a51541107
* https://dartpad.dev/?id=4c639ec89dcc4d1e9e01c82a51541107
* Igor Molchanov <molchanovia.dev@gmail.com>, 25 May 2024
*
* Program output:
* outside started
* inside started
*/
@meg4cyberc4t
meg4cyberc4t / main.dart
Created October 30, 2025 11:03
Отработка при нажатии Curves.easeInOutCubic,Duration(milliseconds: 150), scale: 0,98
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override