This file contains hidden or 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 ninenine | |
sealed class NineNine { | |
abstract fun print99(formatter: String) | |
} | |
class Table(internal val width: Int, internal val height: Int, private val sections: Int = if (width >= 6) 2 else 1) : NineNine() { | |
private val lists = IntRange(1, width).map { Sheet(it, height) }.toList() | |
override fun print99(formatter: String) { |
This file contains hidden or 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 ninenine | |
interface NineNine { | |
fun print99(formatter: String) | |
} | |
class Table(internal val width: Int, internal val height: Int, private val sections: Int = if (width >= 6) 2 else 1) : NineNine { | |
private val lists = IntRange(1, width).map { Sheet(it, height) }.toList() | |
override fun print99(formatter: String) { |
This file contains hidden or 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'; | |
import 'package:intl/intl.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:flutter_localizations/flutter_localizations.dart'; | |
import 'package:intl_translate_example/l10n/messages_all.dart'; | |
void main() => runApp(new MyApp()); | |
class Translations { | |
static Future<Translations> load(Locale locale) { |
This file contains hidden or 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 {defer} from 'rxjs/observable/defer'; | |
import {Observable} from 'rxjs/Observable'; | |
/** Example | |
import {from} from 'rxjs/observable/from'; | |
from([1, 2, 3]) | |
.pipe(doOnSubscribe(() => console.log('subscribed to stream'))) | |
.subscribe(x => console.log(x), null, () => console.log('completed')); | |
*/ |
This file contains hidden or 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'; | |
void main() | |
{ | |
final TextEditingController _controller = new TextEditingController(); | |
var items = ['Working a lot harder', 'Being a lot smarter', 'Being a self-starter', 'Placed in charge of trading charter']; | |
runApp( | |
new MaterialApp( | |
title: 'Drop List Example', | |
home: new Scaffold( |
This file contains hidden or 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 types | |
import typing | |
import ast | |
import inspect | |
class TypeViolationError(TypeError): | |
def __init__(self, variable_name, expected_type, actual_type): | |
super().__init__() | |
self.variable_name = variable_name |
This file contains hidden or 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
// XML generation by code | |
// based on https://www.schibsted.pl/blog/back-end/readable-xml-kotlin-extensions/ | |
fun XmlSerializer.document(docName: String = "UTF-8", | |
xmlStringWriter: StringWriter = StringWriter(), | |
init: XmlSerializer.() -> Unit): String { | |
startDocument(docName, true) | |
xmlStringWriter.buffer.setLength(0) // refreshing string writer due to reuse | |
setOutput(xmlStringWriter) | |
init() | |
endDocument() |
This file contains hidden or 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
val <T> T.` `: T get() = this | |
val <T> T.` `: T get() = this | |
val <T> T.` `: T get() = this | |
val <T> T.` `: T get() = this | |
val <T> T.` `: T get() = this | |
val <T> T.` `: T get() = this | |
val <T> T.` `: T get() = this | |
val <T> T.` `: T get() = this | |
val <T> T.` `: T get() = this | |
val <T> T.` `: T get() = this |
This file contains hidden or 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
// Copyright 2017, the Flutter project authors. Please see the AUTHORS file | |
// for details. All rights reserved. Use of this source code is governed by a | |
// BSD-style license that can be found in the LICENSE file. | |
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(new TestApp()); | |
} |
This file contains hidden or 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 com.google.api.core.ApiFutures; | |
import com.google.firebase.tasks.Tasks; | |
String value = "value"; | |
Exception error = new Exception("custom error"); | |
// Wrap in Tasks | |
Task<String> valueTask = Tasks.forResult(value); | |
Task<String> exceptionTask = Tasks.forException(error); |