Skip to content

Instantly share code, notes, and snippets.

View PlugFox's full-sized avatar
🦊
🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊

Plague Fox PlugFox

🦊
🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊
View GitHub Profile
@PlugFox
PlugFox / main.dart
Last active July 5, 2024 06:52
Controlled Stateful Widget
/*
* Controlled Stateful Widget
* https://gist.github.com/PlugFox/629202b0a7bcde8de3a7503bd33308bc
* https://dartpad.dev?id=629202b0a7bcde8de3a7503bd33308bc
* Mike Matiunin <plugfox@gmail.com>, 05 July 2024
*/
import 'dart:async';
import 'package:flutter/material.dart';
@PlugFox
PlugFox / main.dart
Last active July 1, 2024 09:08
dart void type
void main() {
void value = 'Hello world';
print((value as dynamic).runtimeType);
print(Obj<void>().runtimeType);
print(Obj<void>().type);
print(Obj<void>().type is Type);
}
class Obj<T extends Object?> {
Type get type => T;
@PlugFox
PlugFox / main.dart
Created June 20, 2024 13:59
Clickable painter
import 'package:flutter/material.dart';
import 'dart:math';
void main() => runApp(SegmentWidget());
class _SegmentPainter extends CustomPainter {
static const offset = -pi / 2;
double start;
double end;
@PlugFox
PlugFox / main.dart
Last active June 20, 2024 00:37
Animated Custom Painter
/*
* Animated Custom Painter
* https://gist.github.com/PlugFox/5a0d067bb945057ed2c8adf5702ed893
* https://dartpad.dev?id=5a0d067bb945057ed2c8adf5702ed893
* Mike Matiunin <plugfox@gmail.com>, 19 June 2024
*/
import 'dart:math' as math;
import 'dart:ui' as ui;
@PlugFox
PlugFox / guild_storage.csv
Created June 2, 2024 10:56
Ragnarok Online: Guild storage
id amount aegis name type subtype slots
525 16 Panacea Panacea Healing
603 179 Old_Blue_Box Old Blue Box Usable
604 3899 Branch_Of_Dead_Tree Dead Branch Usable
606 701 Aloebera Aloevera Delayconsume
607 1973 Yggdrasilberry Yggdrasil Berry Healing
616 648 Old_Card_Album Old Card Album Usable
617 1494 Old_Violet_Box Old Purple Box Usable
658 45 Union_Of_Tribe Union of Tribe Usable
662 114 Inspector_Certificate Authoritative Badge Usable
@PlugFox
PlugFox / json.sql
Created May 22, 2024 17:09
SQLITE JSON GENERATED STORED COLUMN EXAMPLE
CREATE TABLE IF NOT EXISTS offer_history (
/* Primary keys */
-- req offer_history id
id TEXT NOT NULL PRIMARY KEY CHECK(id <> '' AND id = (data ->> '$.id')),
/* Raw JSON data */
-- req Raw json data
data TEXT NOT NULL CHECK(data <> '' AND length(data) > 5),
@PlugFox
PlugFox / README.md
Last active May 11, 2024 00:27
Repair and wipe Flutter

Wipe all flutter data

nohup bash -c 'rm -rf ~/.pub-cache $PUB_CACHE \
  && cd $(dirname -- $(which flutter)) \
  && git clean -fdx \
  && (yes | flutter doctor --android-licenses)' > /dev/null 2>&1 & 
@PlugFox
PlugFox / benchmark.dart
Last active May 10, 2024 22:55
Enum utils
import 'package:benchmark_harness/benchmark_harness.dart';
void main() {
final letter = Example.values[25];
final simple = Simple(letter).measure();
final cache = Cache(letter).measure();
print('$simple / $cache = ${simple / cache}'); // 4.074025631823892
}
enum Example {
@PlugFox
PlugFox / main.dart
Last active May 9, 2024 06:12
Hexagons, proof of concept
// ignore_for_file: avoid_print
import 'dart:async';
import 'dart:math' as math;
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
// TODO(plugfox): пропадают элементы снизу при скролле и определенных размерах экранах
// TODO(plugfox): добавить скролл при наведении мыши на края экрана
@PlugFox
PlugFox / main.dart
Last active May 5, 2024 15:25
Seat Viewer
/*
* Seat Viewer
* https://gist.github.com/PlugFox/218f5884cf61130433cd684783fd58b7
* https://dartpad.dev?id=218f5884cf61130433cd684783fd58b7
* Mike Matiunin <plugfox@gmail.com>, 05 May 2024
*/
import 'dart:math' as math;
import 'package:flutter/foundation.dart' show listEquals;