Skip to content

Instantly share code, notes, and snippets.

View yjbanov's full-sized avatar
💭
Building a Web runtime for Flutter: http://bit.ly/flutter-web

Yegor yjbanov

💭
Building a Web runtime for Flutter: http://bit.ly/flutter-web
View GitHub Profile
@yjbanov
yjbanov / streamy-readme.md
Created November 8, 2013 17:57
streamy-readme.md

Streamy

Streamy is a feature-rich RPC/API framework for applications written using Dart programming language. It relies on Google API Discovery file format for API description. Streamy also provides out-of-the-box JSON-over-REST protocol.

Using Streamy your application can:

  • Access many Google APIs, such as Google Calendar API
  • Talk to your own APIs built using Google Cloud Endpoints
  • Talk to your own APIs hosted on your own servers and described using Google Discovery format
@yjbanov
yjbanov / spark-loading-indicator.html
Last active January 4, 2016 14:59
Spark loading indicator concept
<html>
<head>
<style>
#loading-indicator {
position: relative;
height: 3px;
overflow: hidden;
}
#r0 {
@yjbanov
yjbanov / quiver_retry_1.dart
Last active August 29, 2015 14:05
Quiver delay function composition 1
typedef Object OnErrorFunc(Object err, int retry, Duration elapsed);
typedef Duration RetryDelayFunc(Object err, int retry, Duration elapsed);
Future start(
AttemptFunc attempt, {
OnErrorFunc onError: retriesInfinite,
RetryDelayFunc retryDelay: delayNone,
Stopwatch runTime})
----------------------------------------------------------------------------
@yjbanov
yjbanov / quiver_retry_2.dart
Last active August 29, 2015 14:05
Quiver delay function composition 2
/// Returns a [Duration] if another attempt needs to be made after
/// waiting for the returned [Duration]. Returns the error object
/// that instructs the retry mechanism to stop trying and report error
/// immediately.
typedef dynamic OnErrorFunc(Object err, int retry, Duration elapsed);
/// `onError` returns either [Duration] or an error object. If [Duration]
/// is returned, the `attempt` function will be retried after waiting
/// for the returned duration, otherwise the retry mechanism gives up
/// and evaluates the [Future] with the the error object.
Future start(
@yjbanov
yjbanov / tree_code_fmt.dart
Last active February 4, 2016 18:34
trailing commas for tree-like code in Dart
// frameworks such as Flutter and UIX encourage users to express their
// UI using tree-like syntaxes.
// unfortunately dartfmt will format this code:
main() {
var componentTree = new MyButton(
title: 'Save',
onClick: () {
doSomthing();
},
dynamic _createNewInstance(Type type, Provider provider, Injector injector) {
final arguments = provider.dependencies.map(injector.get).toList(growable: false);
return provider.factory(arguments);
}
/// Vends injectable objects, deciding whether they need to be created or
/// reused.
abstract class Scope {
dynamic getInstance(Type type, Provider provider, Injector injector);
}
// contact_editor.dart
// - light-weight annotations
// - DI-related annotations OK
@Component('contact-editor')
class ContactEditor {
String get name => 'John Doe';
bool isEditing = false;
}
// contact_editor.html
@yjbanov
yjbanov / main.dart
Last active May 24, 2017 04:07
sample flutter counter app
import 'package:flutter/widgets.dart';
main() {
runApp(new MyApp());
}
class MyApp extends StatelessWidget {
build(_) => new Text('Hello, World!');
}
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter_travis_sample/main.dart';
void main() {
testWidgets('app should work', (tester) async {
await tester.pumpWidget(new MyApp());
expect(find.text('Hello, World!'), findsOneWidget);
});
}
@yjbanov
yjbanov / .travis.yml
Last active August 6, 2019 17:31
.travis.yml for Flutter
os:
- linux
sudo: false
addons:
apt:
# Flutter depends on /usr/lib/x86_64-linux-gnu/libstdc++.so.6 version GLIBCXX_3.4.18
sources:
- ubuntu-toolchain-r-test # if we don't specify this, the libstdc++6 we get is the wrong version
packages:
- libstdc++6