Skip to content

Instantly share code, notes, and snippets.

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

Plague Fox PlugFox

🦊
🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊🦊
View GitHub Profile
@PlugFox
PlugFox / auth_callback.service
Last active May 16, 2019 13:54
Server-side OAuth2 на dart и go для flutter_web
[Unit]
Description=auth-callback
After=network.target
[Service]
Type=simple
WorkingDirectory=/var/www/domain.tld/callback
RemainAfterExit=false
RestartSec=5s
ExecStart=/var/www/domain.tld/callback/callback.run
@PlugFox
PlugFox / main.dart
Last active June 4, 2019 16:34
DateRange for dart
/*
* Период дат
* https://gist.github.com/PlugFox/cec72af345db58cc8911f012d138a8a0
* https://dartpad.dartlang.org/cec72af345db58cc8911f012d138a8a0
*/
class DateRange {
DateTime begin = new DateTime(1);
DateTime end = new DateTime(1);
int get length => _dateToDays(this.end)-_dateToDays(this.begin);
@PlugFox
PlugFox / main.dart
Last active June 4, 2019 16:32
Многострочная запись в dart
/*
* Многострочная запись в dart
* https://gist.github.com/PlugFox/de8129130c0bfe91276e43dccce7becd
* https://dartpad.dartlang.org/de8129130c0bfe91276e43dccce7becd
*/
void main() {
final String msg = '''
|---------------
| MESSAGE
@PlugFox
PlugFox / main.dart
Last active June 4, 2019 16:32
ДЕМОНСТРАЦИЯ ГЕТТЕРОВ ОПРЕДЕЛЕННЫХ СОСТОЯНИЙ ПОТОКА БЛоКа
/*
* ДЕМОНСТРАЦИЯ ГЕТТЕРОВ ОПРЕДЕЛЕННЫХ СОСТОЯНИЙ ПОТОКА БЛоКа
* https://gist.github.com/PlugFox/bf01b1bff1df772aadcbcc5031719a79
* https://dartpad.dartlang.org/bf01b1bff1df772aadcbcc5031719a79
*/
import 'dart:async';
class Demo {
@PlugFox
PlugFox / main.dart
Last active June 4, 2019 16:30
Dart singleton example
/*
* https://gist.github.com/PlugFox/8cdfd371fcf14bf653f28719bf2e5cb1
* https://dartpad.dartlang.org/8cdfd371fcf14bf653f28719bf2e5cb1
*/
class IStoreDataForYou {
int myValue;
// SINGLETON +
IStoreDataForYou._();
The MIT License
Copyright (c) 2019 @PlugFox
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@PlugFox
PlugFox / main.dart
Last active June 4, 2019 13:48
KeepAlive checker with timer
/*
* https://gist.github.com/PlugFox/2466b8f34183743281be0a9fa155a777
* https://dartpad.dartlang.org/2466b8f34183743281be0a9fa155a777
*/
import "dart:async";
class KeepAlive {
static const _lockSecondsCountdown = 10;
static const _timeout = const Duration(seconds: 1);
@PlugFox
PlugFox / main.dart
Last active June 8, 2019 17:31
Демонстрация реактивного программирования для https://t.me/rudart
/*
* Демонстрация реактивного программирования для https://t.me/rudart
* https://gist.github.com/PlugFox/6e79a1f5cc6e32a4df1081bd27edb38c
* https://dartpad.dartlang.org/6e79a1f5cc6e32a4df1081bd27edb38c
*/
import 'dart:async';
class MyString {
final StreamController<String> _sc = new StreamController<String>.broadcast();
@PlugFox
PlugFox / main.dart
Last active June 17, 2019 13:58
Пример парсинга json с использованием каскадной нотации для https://t.me/rudart
/*
* Пример парсинга json с использованием каскадной нотации
* для https://t.me/rudart
* https://gist.github.com/PlugFox/0f4c182950895f7033d26204911dad6a/
* https://dartpad.dartlang.org/0f4c182950895f7033d26204911dad6a
*/
// Описание каскадной нотации:
// https://dart.dev/guides/language/language-tour#cascade-notation-
@PlugFox
PlugFox / main.dart
Last active November 22, 2023 18:35
Throttling and Debouncing
/*
* Throttling and Debouncing in dart for https://pub.dev/packages/throttling
* https://gist.github.com/PlugFox/8630021e5c7ab9d27b74e86372f74c31
* https://dartpad.dev?id=8630021e5c7ab9d27b74e86372f74c31
* Matiunin Mikhail <plugfox@gmail.com>, 22 November 2023
*/
// ignore_for_file: avoid_print, cascade_invocations, unawaited_futures
import 'dart:async';