- Introduction to Functional Programming Johannes Weiß - https://vimeo.com/100786088
- ReactiveCocoa at MobiDevDay Andrew Sardone - https://vimeo.com/65637501
- The Future Of ReactiveCocoa Justin Spahr-Summers - https://www.youtube.com/watch?v=ICNjRS2X8WM
- Enemy of the State Justin Spahr-Summers - https://www.youtube.com/watch?v=7AqXBuJOJkY
- WWDC 2014 Session 229 - Advanced iOS Application Architecture and Patterns Andy Matuschak - https://developer.apple.com/videos/play/wwdc2014/229/
- Functioning as a Functionalist Andy Matuschak - https://www.youtube.com/watch?v=rJosPrqBqrA
- Controlling Complexity in Swift Andy Matuschak - https://realm.io/news/andy-matuschak-controlling-complexity/
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
| abstract class RadioAdapter<T> extends RecyclerView.Adapter<RadioAdapter.ViewHolder> { | |
| public int mSelectedItem = -1; | |
| private Context mContext; | |
| private List<T> mItems; | |
| public RadioAdapter(Context context, List<T> items) { | |
| mContext = context; | |
| mItems = items; | |
| } |
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
| // H/t to https://github.com/ethankhall/scripts/blob/master/gradle/find-file.gradle for the idea; | |
| // this re-written version actually works in modern Gradle and Android Gradle plugins. | |
| task findInDependencies << { | |
| println() | |
| def resolvableConfigs = project.getConfigurations() | |
| .stream() | |
| .filter { it.isCanBeResolved() } |
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 static class ExampleViewHolder extends RecyclerView.ViewHolder | |
| implements View.OnClickListener { | |
| private int originalHeight = 0; | |
| private boolean isViewExpanded = false; | |
| private YourCustomView yourCustomView | |
| public ExampleViewHolder(View v) { | |
| super(v); | |
| v.setOnClickListener(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
| val memIsTextPresent = Memoize(::isTextPresent) | |
| fun isTextPresent(path: Path, text: String) = path.toFile().readText().contains(text, true) | |
| class Memoize<A, B, C>(val func: (A, B) -> C) : (A, B) -> C { | |
| val cache = ConcurrentHashMap<String, C>() | |
| override fun invoke(p1: A, p2: B) = cache.getOrPut(p1.toString(), { func(p1, p2) }) | |
| } |
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 .... my_text as text // для сокращения чтоб не писать очень_длинное_имя (пример) | |
| import .....button as btn | |
| class MainActivity : AppCompatActivity() { | |
| override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) | |
| setContentView(R.layout.activity_main) | |
| button.setOnClickListener { setMyText() } <- повесили обработчик клика |
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
| /* | |
| * The MIT License (MIT) | |
| * | |
| * Copyright (c) 2015 Alex Fu | |
| * | |
| * Permission is hereby granted, free of charge, to any person obtaining a copy | |
| * of this software and associated documentation files (the "Software"), to deal | |
| * in the Software without restriction, including without limitation the rights | |
| * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| * copies of the Software, and to permit persons to whom the Software is |
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 android.graphics.Rect; | |
| import android.support.v7.widget.GridLayoutManager; | |
| import android.support.v7.widget.RecyclerView; | |
| import android.view.View; | |
| public class EqualSpacingItemDecoration extends RecyclerView.ItemDecoration { | |
| private final int spacing; | |
| private int displayMode; | |
| public static final int HORIZONTAL = 0; |
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
| class AccountHolder extends MvpViewHolder implements AccountView { | |
| @InjectPresenter | |
| AccountPresenter mAccountPresenter; | |
| /** | |
| @BindView(R.id.item_account_check_box) | |
| CheckBox mCheckBox; | |
| ... | |
| **/ |
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 us.nineworlds.serenity.ui.views.mvp; | |
| import android.annotation.TargetApi; | |
| import android.content.Context; | |
| import android.os.Build; | |
| import android.os.Parcelable; | |
| import android.support.annotation.AttrRes; | |
| import android.support.annotation.NonNull; | |
| import android.support.annotation.Nullable; | |
| import android.support.annotation.StyleRes; |