$ brew install dnsmasq
$ echo 'address=/.test/127.0.0.1' >> /opt/homebrew/etc/dnsmasq.conf
| import 'package:flutter/material.dart'; | |
| class NestedWillPopScope extends StatefulWidget { | |
| const NestedWillPopScope({ | |
| Key? key, | |
| required this.child, | |
| required this.onWillPop, | |
| }) : super(key: key); | |
| final Widget child; |
| @Query('SELECT * FROM article ORDER BY publishedAt DESC') | |
| Stream<List<Article>> getAllArticles(); | |
| @Query('SELECT Author.*, _junction.articleId as articleId FROM ArticleAuthor AS _junction inner join Author ON (_junction.authorId = Author.id) WHERE _junction.articleId IN (:ids)') | |
| Future<List<AuthorArticleId>> getAuthorsFromArticles(List<int> ids); | |
| Stream<List<ArticleWithAuthor>> getAllArticlesWithAuthors() { | |
| final stream = getAllArticles(); | |
| final controller = StreamController<List<ArticleWithAuthor>>.broadcast(); |
| By default, when extracts the Xcode.zip, | |
| macos will create tmp file in `/private/var/folders/v2/tbmrn60d2910x3w23ys5fgs00000gn/T/com.apple.AUHelperService`. | |
| Sometimes, the /private has no ehough space to hold 19GB Xcode.app. | |
| Thus we can create a soft link named `com.apple.AUHelperService` in the tmp dir. | |
| Steps: | |
| 1. BACKUP `com.apple.AUHelperService` in `/private/var/folders/v2/tbmrn60d2910x3w23ys5fgs00000gn/T/` to `com.apple.AUHelperService_BACKUP` | |
| 2. mkdir named `com.apple.AUHelperService` wherever you have enough space, | |
| 3. ln -s /your/absolute/path/com.apple.AUHelperService /private/var/folders/v2/tbmrn60d2910x3w23ys5fgs00000gn/T | |
| 4. double click the Xcode.xip |
| class BlocProvider<Value, Bloc extends _bloc.Bloc<dynamic, Value>> | |
| extends ValueDelegateWidget<Bloc> implements SingleChildCloneableWidget { | |
| /// Allows to specify parameters to [BlocProvider]. | |
| BlocProvider({ | |
| Key key, | |
| @required ValueBuilder<Bloc> builder, | |
| UpdateShouldNotify<Value> updateShouldNotify, | |
| UpdateShouldNotify<Value> blocUpdateShouldNotify, | |
| Disposer<Bloc> dispose, | |
| Widget child, |
| import 'dart:async'; | |
| import 'package:bloc/bloc.dart'; | |
| import 'package:equatable/equatable.dart'; | |
| abstract class AuthenticationEvent extends Equatable { | |
| AuthenticationEvent([List props = const []]) : super(props); | |
| } | |
| class LoginEvent extends AuthenticationEvent { | |
| final String loginRequest; |
| # Original source: https://gist.github.com/hopsoft/56ba6f55fe48ad7f8b90 | |
| # Merged with: https://gist.github.com/kofronpi/37130f5ed670465b1fe2d170f754f8c6 | |
| # Benefits of: https://gist.github.com/e12e/e0c7d2cc1d30d18c8050b309a43450ac | |
| # And fixes of: https://gist.github.com/joelvh/f50b8462611573cf9015e17d491a8a92 | |
| namespace :db do | |
| desc 'Dumps the database to backups' | |
| task dump: :environment do | |
| dump_fmt = ensure_format(ENV['format']) | |
| dump_sfx = suffix_for_format(dump_fmt) | |
| backup_dir = backup_directory(Rails.env, create: true) |
| import configparser | |
| from dataclasses import dataclass | |
| @dataclass | |
| class Sections: | |
| raw_sections: dict | |
| def __post_init__(self): | |
| for section_key, section_value in self.raw_sections.items(): |