This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
testWidgets('StreamController adding null wtf', (WidgetTester tester) async { | |
final source = StreamController<String>(); | |
var index = 0; | |
await tester.pumpWidget(MaterialApp( | |
home: StreamBuilder( | |
stream: source.stream, | |
builder: (context, snapshot) { | |
index += 1; | |
return Text('$index'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:async'; | |
Future<void> b(value) async { | |
await Future.delayed(Duration(seconds: 0)); | |
// OR: remove the line ABOVE for fun effect. | |
print('b(${value})'); | |
} | |
Future<void> a(value) async { | |
print('a(${value})'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A { | |
String value; | |
A(this.value) { print(value); } | |
String toString() => value; | |
} | |
class B { | |
A a = A('Default'); | |
B(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:core'; | |
void main() { | |
final commonOptions = { | |
'subject': 'test', | |
'body': 'foobar', | |
}; | |
print(Uri(scheme: 'mailto', path: '[email protected]', queryParameters: commonOptions)); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:firebase_database/firebase_database.dart'; | |
import 'package:flutter/foundation.dart'; | |
void main() => runApp(new MyApp()); | |
class MyApp extends StatelessWidget { | |
const subpath = 'flutter-firebase-order-by-child'; | |
MyApp() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Portions Copyright Chromium Project. | |
import base64 | |
import hashlib | |
import hmac | |
import json | |
import os | |
import sys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- emulator -avd test -no-window: | |
background: true | |
- circle-android wait-for-boot | |
# Wait until there's no log spam for some time -- means all Google Play Services have booted. | |
- > | |
while ! cmp /tmp/android.log /tmp/android-previous.log; do | |
mv /tmp/android.log /tmp/android-previous.log | |
sleep 20 | |
# Compare the last few lines of logcat | |
adb logcat -t 25 >/tmp/android.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
sleep 5 | |
if /sbin/ifconfig usb0 &>/dev/null; then | |
# usb0 is present - we are in slave mode, this script won't work. | |
exit | |
fi | |
led() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"log" | |
"net/http" | |
"google.golang.org/api/oauth2/v2" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define I2CAddress 0x42 | |
void setup() { | |
Wire.begin(I2CAddress); | |
// Remember to keep those handlers as time-critical as possible: | |
// no interrupts will be happening while these are running. | |
// Also the other end of i2c communication might just | |
// give up waiting. So keep the logic in loop() and let i2c | |
// handlers only operate on ready data. | |
Wire.onReceive(i2cReceive); |
NewerOlder