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
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() | |
} | |
} |
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 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 { |
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
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 { |
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 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 |
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
android { | |
signingConfigs { | |
release | |
} | |
buildTypes { | |
release { | |
signingConfig signingConfigs.release | |
} | |
} |
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
// | |
// gorun - Script-like runner for Go source files. | |
// | |
// https://wiki.ubuntu.com/gorun | |
// | |
// Copyright (c) 2011 Canonical Ltd. | |
// | |
// Written by Gustavo Niemeyer <gustavo.niemeyer@canonical.com> | |
// | |
package main |
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 | |
/* | |
* A simple go program to download all the high resolution pictures from your facebook albums. | |
* | |
* To run this: | |
* 1. Go to https://developers.facebook.com/tools/explorer/?method=GET&path=me&version=v2.8 | |
* 2. Get an Access Token: Get Token > Get User Access Token > Check "user_photos" | |
* 3. Paste in the app. | |
*/ |
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 android.app.Activity | |
import android.content.Intent | |
import android.os.Parcel | |
import android.os.Parcelable | |
import java.io.Closeable | |
import java.util.UUID | |
import java.util.concurrent.ConcurrentHashMap | |
/** | |
* A special [Parcelable] that carries an in-memory reference to any instance of type [T], which will obviously |
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
// ...stuff... | |
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> { | |
kotlinOptions { | |
freeCompilerArgs = listOf( | |
"-Xnew-inference", | |
"-Xallow-kotlin-package" | |
) | |
} | |
} |