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 sys | |
| # Note ('s are not currently supported. Given we treat them as | |
| # 'frames' they are implicitly simple to recursivly implement. | |
| ops = ['^', '*', '/', '+', '-'] | |
| # 1 + 2 -> + 1 2 | |
| # 1 + 2 * 3 -> + * 3 2 1 | |
| def parser(tokens): | |
| stack = [] |
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
| /** | |
| * usage: ./bf "<program>" | |
| * example: ./bf ",[>++<-]>. ; multiplies a number by 2" | |
| * | |
| * Brainfuck Interpreter | |
| * | |
| * BF has the following commands: | |
| * > Move to next memory position | |
| * < Move to prev memory position | |
| * + Increment current memory position |
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
| public abstract class Function<A, B> { | |
| public abstract B apply(A arg); | |
| // Given f :: a -> b and g :: b -> c, we can define h :: a -> c as the composition of f and g | |
| public static <A, B, C> Function<A, C> compose(final Function<A, B> x, final Function<B, C> y) { | |
| return new Function<A, C>() { | |
| @Override | |
| public C apply(A arg) { | |
| return y.apply(x.apply(a)); |
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
| public abstract class ButterKnifeViewHolder(val itemView : View) {} | |
| public fun <T : View> ButterKnifeViewHolder.bindView(id: Int): ReadOnlyProperty<Any, T> = ViewBinding(id) | |
| public fun <T : View> ButterKnifeViewHolder.bindOptionalView(id: Int): ReadOnlyProperty<Any, T?> = OptionalViewBinding(id) | |
| public fun <T : View> ButterKnifeViewHolder.bindViews(vararg ids: Int): ReadOnlyProperty<Any, List<T>> = ViewListBinding(ids) | |
| public fun <T : View> ButterKnifeViewHolder.bindOptionalViews(vararg ids: Int): ReadOnlyProperty<Any, List<T>> = OptionalViewListBinding(ids) |
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 org.exallium.tradetracker.app.controller.adapters | |
| import android.view.LayoutInflater | |
| import android.view.View | |
| import android.view.ViewGroup | |
| import android.widget.BaseAdapter | |
| import android.widget.Filter | |
| import android.widget.Filterable | |
| import android.widget.TextView | |
| import com.orm.query.Condition |
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
| data class MyValueObject(val a: Int, val b: 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 controller | |
| public class Controller { | |
| val editText : RxEditText<User> = // ... | |
| val model : Model<User> = // ... | |
| val modelObserver: Observer<User>? = null | |
| val editTextObserver: Observer<User>? = null | |
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
| /* within adapter class */ | |
| private static class ItemDeletate<T> { | |
| private final T item; | |
| private boolean isViewed; | |
| public ItemDelegate(T item) { | |
| this.item = item; | |
| } |
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
| public enum Action { | |
| ACTION1, ACTION2 | |
| } |
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
| // Workaround for missing test resources when run unit tests within android | |
| // studio. | |
| // This copy the test resources next to the test classes for each variant. | |
| // Tracked at https://github.com/nenick/AndroidStudioAndRobolectric/issues/7 | |
| // Original solution comes from | |
| // https://code.google.com/p/android/issues/detail?id=136013#c10 | |
| // apply with: | |
| // apply from: build.workaround-missing-resources.gradle | |
| gradle.projectsEvaluated { |