View ExhaustiveWhen.kt
// root package looks great when importing, ie. `import exhaustive`
* Allows requiring an exhaustive mapping in a `when` block when used with the [rangeTo] operator.
* @sample [exhaustive_when_example]
object exhaustive {
View facebook-photo-download.go
package main
* A simple go program to download all the high resolution pictures from your facebook albums.
* To run this:
* 1. Go to
* 2. Get an Access Token: Get Token > Get User Access Token > Check "user_photos"
* 3. Paste in the app.
View gorun.go
// gorun - Script-like runner for Go source files.
// Copyright (c) 2011 Canonical Ltd.
// Written by Gustavo Niemeyer <>
package main
View SharedPreferencesPropertyDelegate.kt
import kotlin.reflect.KProperty
interface SharedPreferencesWriter //TODO
interface SharedPreferencesWriterProvider {
val sharedPreferencesWriter: SharedPreferencesWriter
fun <T> prefs() = SharedPreferencesPropertyDelegate<T>()
View demo.dart
// animated GIF:
// see
import 'package:flutter/material.dart';
import 'ink_text_selection_layout.dart';
class Demo extends StatelessWidget {
Widget build(context) => inkTextSelectionLayout(
View SingletonObservable.kt
import rx.Observable
import rx.subjects.BehaviorSubject
import SingletonObservable.ItemWrapper
* Represents the current subscription status (either 'unsubscribed' or 'subscribed') of a [SingletonObservable].
* The index starts at [SingletonObservable.firstSubscriptionIndex] as 'unsubscribed', and every subsequent value alternates between the two states.
* Use [SingletonObservable.isSubscribed] to calculate the status for a specific [SubscriptionIndex].
* Note that a subscription index is constant for the lifetime of a stream, which is completed by the first time either one of
View Example.kt
fun test() {
val item1 = Item(GameObject())
val item2 = Item(GameObject())
assert(ItemStack(setOf(item1, item2)) is ItemStack)
assert(ItemStack(setOf(item1)) is Item)
assert(ItemStack(emptySet()) is Empty)
class ItemStack private constructor(val items: Set<Item>) : Elem() {
companion object {
View Test.kt
fun test() {
val lines = use {
val a = File("path1").reader().use
val b = File("path2").reader().use
val c = File("path3").reader().use
a.readLines() + b.readLines() + c.readLines()
import android.animation.TimeInterpolator;
* Interpolator that produces a decaying sine wave oscillating around zero.
public class ShakeInterpolator implements TimeInterpolator {
private static final double AMP, FREQ = 5, DECAY = 6;
static {
package me.eugeniomarletti.example;
import android.os.Bundle;
import android.widget.Toast;
import rx.Observable;
import rx.Subscriber;
import rx.Subscription;