Skip to content

Instantly share code, notes, and snippets.

@britannio
britannio / build.yaml
Last active September 23, 2022 10:37
Example build.yaml config for https://pub.dev/packages/build_runner using ferry, moor, freezed, json_serializable and injectable
targets:
$default:
sources:
exclude:
- "**/components/**"
- "**/exceptions/**"
- "test/**"
builders:
gql_build|schema_builder:
@britannio
britannio / main.dart
Last active January 9, 2022 19:48
Iterable Equality Ignoring Ordering in Dart
import 'package:collection/collection.dart';
void main() {
print([1,2,3].isEqualToIgnoringOrdering({3,2,1})); // true
}
extension IsEqualToIgnoringOrdering<T> on Iterable<T> {
bool isEqualToIgnoringOrdering(Iterable<T> other) {
return const UnorderedIterableEquality().equals(this, other);
}
@britannio
britannio / new_project.json
Created August 13, 2023 11:00
My Google Visual Blocks Demo
{
"project": {
"name": "New project",
"id": "new",
"creationTs": 1691921932988,
"lastModifiedTs": 1691923674233
},
"graph": {
"nodes": [
{
module QuickSortMemSimple
let rec length #a (l:list a)
: nat
= match l with
| [] -> 0
| _ :: tl -> 1 + length tl
let rec append #a (l1 l2:list a)
: list a
module QuickSortPermutation
#push-options "--fuel 1 --ifuel 1"
//Some auxiliary definitions to make this a standalone example
let rec length #a (l:list a)
: nat
= match l with
| [] -> 0
| _ :: tl -> 1 + length tl
module QuickSortMem
//Some auxiliary definitions to make this a standalone example
let rec length #a (l:list a)
: nat
= match l with
| [] -> 0
| _ :: tl -> 1 + length tl
let rec append #a (l1 l2:list a)
module QuickSortPermutationSimple
#push-options "--fuel 1 --ifuel 1"
//Some auxiliary definitions to make this a standalone example
let rec length #a (l:list a)
: nat
= match l with
| [] -> 0
| _ :: tl -> 1 + length tl