Skip to content

Instantly share code, notes, and snippets.

Avatar
🦊
🦊🦊🦊🦊🦊

Plague Fox PlugFox

🦊
🦊🦊🦊🦊🦊
View GitHub Profile
View event_queue.dart
import 'dart:async';
import 'dart:collection';
import 'dart:developer' as developer;
/// Async callback
typedef EventCallback = FutureOr<void> Function();
/// {@template event_queue}
/// An event queue is a queue of [EventCallback]s that are executed in order.
/// {@endtemplate}
@PlugFox
PlugFox / change_notifier_selector.dart
Last active Jul 21, 2022
Listenable --- selector & filter --> ValueListenable<Value>
View change_notifier_selector.dart
import 'package:flutter/foundation.dart'
show Listenable, ValueListenable, VoidCallback, ChangeNotifier;
/// Selector from [Listenable]
typedef ChangeNotifierSelector<Controller extends Listenable, Value> = Value
Function(
Controller controller,
);
/// Filter for [Listenable]
@PlugFox
PlugFox / traefik_portainer.yml
Created Jul 14, 2022
Traefik with Portainer
View traefik_portainer.yml
version: '3.9'
services:
# Traefik is the reverse proxy
traefik:
hostname: traefik
image: "traefik:v2.8.0"
#healthcheck:
# test: timeout 10s bash -c ':> /dev/tcp/127.0.0.1/80' || exit 1
# interval: 30s
@PlugFox
PlugFox / main.dart
Last active Jul 21, 2022
Layer link
View main.dart
/*
* Layer link
* https://gist.github.com/PlugFox/dbd122459cc911589cba450e1613355c
* https://dartpad.dev/dbd122459cc911589cba450e1613355c
* Matiunin Mikhail <plugfox@gmail.com>, 21 July 2022
*/
import 'dart:async';
import 'dart:developer' as dev;
import 'dart:math' as math;
@PlugFox
PlugFox / README.md
Created Jul 10, 2022
Ubuntu server preparation
View README.md

Initial login with ssh root@domain.tld

Get OS info

cat /etc/os-release

Update and upgrade

apt update && apt upgrade
@PlugFox
PlugFox / main.dart
Created Jun 8, 2022
Creating new isolate in dart and communicate with it
View main.dart
/// Creating new isolate and communicate with it
import 'dart:convert';
import 'dart:isolate';
import 'package:stream_transform/stream_transform.dart';
void main() => Future<void>(() async {
final receivePort = ReceivePort();
final stream = receivePort.asBroadcastStream();
@PlugFox
PlugFox / index.html
Last active Jun 7, 2022
Dart Pad with html index.html
View index.html
<h1 id="header">empty</h1>
View main.dart
void main() {
print('Hello world');
}
@PlugFox
PlugFox / main.dart
Last active Jun 7, 2022
Enum with Expando
View main.dart
/*
* Enum with expando properties
* https://gist.github.com/PlugFox/ed18b5ce21c5286b5a95d2efa34958f1
* https://dartpad.dev/ed18b5ce21c5286b5a95d2efa34958f1
* Matiunin Mikhail <plugfox@gmail.com>, 07 June 2022
*/
void main() {
final red = Color.red;
final green = Color.green;
@PlugFox
PlugFox / main.dart
Created Jun 3, 2022
Providing data using zones
View main.dart
/*
* Providing data using zones
* https://gist.github.com/PlugFox/d35b4beb298e62819152cd259d4f44ca
* https://dartpad.dev/d35b4beb298e62819152cd259d4f44ca
* Matiunin Mikhail <plugfox@gmail.com>, 03 June 2022
*/
import 'dart:async';
void main() {