Skip to content

Instantly share code, notes, and snippets.

View atn832's full-sized avatar

Anh Tuan Nguyen atn832

View GitHub Profile
@atn832
atn832 / gist:5dcae11307d4c59de143a3259dbb87cf
Created April 5, 2020 01:24
cloud_firestore_behaviors fail when casting to Map<String, dynamic>
flutter: 00:00 +0: Firestore behavior comparison: Document creation by add (Cloud Firestore)
VMServiceFlutterDriver: Connected to Flutter application.
path: satisfied (Path is satisfied), interface: en1
flutter: 00:01 +1: Firestore behavior comparison: Document creation by add (Firestore Emulator)
path: satisfied (Path is satisfied), interface: en1
flutter: 00:01 +2: Firestore behavior comparison: Document creation by add (cloud_firestore_mocks)
flutter: 00:01 +3: Firestore behavior comparison: Invalidate bad values (Cloud Firestore)
flutter: 00:01 +4: Firestore behavior comparison: Invalidate bad values (Firestore Emulator)
flutter: 00:01 +5: Firestore behavior comparison: Invalidate bad values (cloud_firestore_mocks)
flutter: 00:01 +6: Firestore behavior comparison: Array containing a cycle (Cloud Firestore)
@atn832
atn832 / gist:5c0537bbc660fd0c9b76385ed8ed6b8b
Created April 5, 2020 01:29
throws a CastError instead of a TypeError
flutter: 00:18 +36: Firestore behavior comparison: Transaction handler returning non-map result (Cloud Firestore) [E]
flutter: Expected: throws <Instance of 'TypeError'>
Actual: <Closure: () => Future<dynamic>>
Which: threw _CastError:<type 'int' is not a subtype of type 'Map<dynamic, dynamic>' in type cast>
stack package:flutter/src/services/platform_channel.dart 156:41 MethodChannel._invokeMethod
===== asynchronous gap ===========================
package:test_api expect
package:flutter_test/src/widget_tester.dart 348:3 expect
Users/anhtuan/git/cloud_firestore_mocks/test_driver/cloud_firestore_behaviors.dart 411:7 main.<fn>.<fn>
dart:async _completeOnAsyncReturn
@atn832
atn832 / gist:9b4106ea68b8e9a5f228bd812a0a3d66
Created April 5, 2020 01:32
Test logs after fixing the cast exception
flutter: 00:00 +0: Firestore behavior comparison: Document creation by add (Cloud Firestore)
VMServiceFlutterDriver: Connected to Flutter application.
path: satisfied (Path is satisfied), interface: en1
flutter: 00:01 +1: Firestore behavior comparison: Document creation by add (Firestore Emulator)
path: satisfied (Path is satisfied), interface: en1
flutter: 00:01 +2: Firestore behavior comparison: Document creation by add (cloud_firestore_mocks)
flutter: 00:01 +3: Firestore behavior comparison: Invalidate bad values (Cloud Firestore)
flutter: 00:01 +4: Firestore behavior comparison: Invalidate bad values (Firestore Emulator)
flutter: 00:01 +5: Firestore behavior comparison: Invalidate bad values (cloud_firestore_mocks)
flutter: 00:01 +6: Firestore behavior comparison: Array containing a cycle (Cloud Firestore)
I/flutter (19060): 00:34 +8 -1: Firestore behavior comparison: Document creation by setData (Cloud Firestore) [E]
I/flutter (19060): type '_InternalLinkedHashMap<dynamic, dynamic>' is not a subtype of type 'Map<String, dynamic>' in type cast
I/flutter (19060): Users/anhtuan/git/cloud_firestore_mocks/test_driver/cloud_firestore_behaviors.dart 138:43 main.<fn>.<fn>
I/flutter (19060): ===== asynchronous gap ===========================
I/flutter (19060): dart:async/zone.dart 1064:19 _CustomZone.registerBinaryCallback
I/flutter (19060): dart:async-patch/async_patch.dart 82:23 _asyncErrorWrapperHelper
I/flutter (19060): package:test_api/src/backend/invoker.dart Invoker.waitForOutstandingCallbacks.<fn>
I/flutter (19060): dart:async/zone.dart 1126:13 _rootRun
I/flutter (19060): da
@atn832
atn832 / gist:68202bf555d8b677911da4838498a23e
Created May 26, 2020 02:25
Error when running `airflow scheduler`
$ airflow scheduler
____________ _____________
____ |__( )_________ __/__ /________ __
____ /| |_ /__ ___/_ /_ __ /_ __ \_ | /| / /
___ ___ | / _ / _ __/ _ / / /_/ /_ |/ |/ /
_/_/ |_/_/ /_/ /_/ /_/ \____/____/|__/
[2020-05-26 11:24:34,913] {__init__.py:51} INFO - Using executor SequentialExecutor
[2020-05-26 11:24:34,918] {scheduler_job.py:1346} INFO - Starting the scheduler
[2020-05-26 11:24:34,918] {scheduler_job.py:1354} INFO - Running execute loop for -1 seconds
[2020-05-26 11:24:34,918] {scheduler_job.py:1355} INFO - Processing each file at most -1 times
(tfx-env) $ python -V
Python 3.6.8
(tfx-env) $ pip list
Package Version
------------------------------ -----------
absl-py 0.8.1
alembic 1.4.2
ansiwrap 0.8.4
apache-airflow 1.10.10
INFO:absl:MetadataStore with DB connection initialized
2020-06-01 11:33:49.245168: W ml_metadata/metadata_store/rdbms_metadata_access_object.cc:453] No property is defined for the Type
INFO:absl:Running executor for ImportExampleGen
INFO:absl:Attempting to infer TFX Python dependency for beam
INFO:absl:Generating a temp requirements.txt file at /tmp/tmpyxtc0v3k/requirement.txt
INFO:absl:Added --requirements_file=/tmp/tmpyxtc0v3k/requirement.txt to beam args
INFO:absl:Generating examples.
INFO:absl:Using 12 process(es) for Beam pipeline execution.
INFO:absl:Reading input TFExample data /[homefolder]/mnist/data/*.
INFO:absl:Examples generated.
@atn832
atn832 / main.dart
Created June 7, 2020 07:30
Stream demo
Stream<String> getWeather() async* {
await Future.delayed(Duration(seconds: 3));
yield "Sunny";
await Future.delayed(Duration(seconds: 3));
yield "Cloudy";
await Future.delayed(Duration(seconds: 3));
yield "Rainy";
}
void main() async {
@atn832
atn832 / nullfunction.dart
Created March 13, 2021 03:03
calling a null function with null safety
Function? confirm = null;
main() {
// even with null safety on, the compiler won't complain.
// but if you run it, it will throw an exception.
confirm!();
}
{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"width": 700,
"height": 800,
"padding": 5,
"title": "Graphics cards performance over time",
"data": [
{
"name": "thresholds",