Skip to content

Instantly share code, notes, and snippets.

View ebwood's full-sized avatar
🎯
keep running, keep coding

ebwood ebwood

🎯
keep running, keep coding
  • Wood Tech
View GitHub Profile
@ebwood
ebwood / download_limit.dart
Created April 20, 2024 08:52
simulate download task count limit and speed limit
import 'dart:async';
import 'dart:math';
import 'package:collection/collection.dart';
extension on int {
int get mb => this * 1024 * 1024;
}
void main() {
DownloadPool pool = DownloadPool(maxTaskCount: 5, maxDownloadSpeed: 2.mb);
@ebwood
ebwood / curry.dart
Created February 1, 2024 13:31
dart curry and uncurry using operator overload
// function void
typedef FunctionVoid = void Function();
// function0
typedef Function0<T> = T Function();
// function1
typedef Function1<T, A> = T Function(A a);
// uncurry function2
typedef UncurryFunction2<T, A, B> = T Function(A a, B b);
@ebwood
ebwood / FileUtil.dart
Created May 19, 2022 08:59
Create Unique Fiel in dart
import 'dart:io';
import 'package:path/path.dart' as path;
class FileUtil {
static File getUniqueFile(String folderName, final String? fileName) {
int num = 1;
String destFileName =
fileName ?? '${DateTime.now().millisecondsSinceEpoch}';
@ebwood
ebwood / conventional_commit.sh
Last active December 4, 2021 06:23
conventional_commit.sh
#!/bin/bash
# 0. init git repository
git init
# 1. install node
brew install node
# 2. add conventional commit folders to .gitignore
echo "
@ebwood
ebwood / conventional_commit_library.md
Last active October 30, 2023 15:23
commitlint + husky + commitizen

commitlint + husky + commitizen

  1. git init(if project is not git repository).

  2. install node:

    brew install node
mixin Dog {
void run() {
print('Dog run');
}
void walk() {
print('Dog walk');
}
}
class HairColorNotifier extends ValueNotifier<int> {
HairColorNotifier(int value1) : super(value1);
}
class HairColorInheritedWidget extends InheritedNotifier<HairColorNotifier> {
HairColorInheritedWidget(
{Key? key, required Widget child, required HairColorNotifier notifier})
: super(key: key, child: child, notifier: notifier);
@ebwood
ebwood / test.dart
Created August 19, 2020 05:38
gist test for dart
void main() {
print('gist for dart');
}
@ebwood
ebwood / introrx.md
Created August 10, 2020 01:34 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
{"lastUpload":"2020-06-23T01:33:43.591Z","extensionVersion":"v3.4.3"}