Skip to content

Instantly share code, notes, and snippets.

@lgvalle
lgvalle / step1.js
Last active Aug 8, 2017
Post: Take control of your backend (I)
View step1.js
exports.fetch = functions.https.onRequest((req, res) => {
() // TODO Fetch from API
() // TODO Clean up
() // TODO Return result
})
View gist:3ad43349c4e0202ec147
public class HomePresenterImpl implements HomePresenter {
private static final String TAG = HomePresenterImpl.class.getSimpleName();
private final HomeScreen screen;
private final DataProvider provider;
private Subscription subscription1;
public HomePresenterImpl(HomeScreenImpl screen, DataProvider dataProvider) {
this.screen = screen;
this.provider = dataProvider;
}
View FacebookHomeProvider.java
public class FacebookHomeProvider {
protected final PublishSubject<FbPost> behaviorSubject;
private Request request;
public FacebookHomeProvider() {
behaviorSubject = PublishSubject.create();
behaviorSubject.subscribeOn(Schedulers.io());
}
/**
View legacyActivity.java
public class LoginActivity extends Activity {
private EditText mEmailEdit;
private EditText mPassword;
private Button btnSend;
private EditText mPhoneNumber;
private TextWatcher watcher;
@Override
protected void onCreate(Bundle savedInstanceState) {
View WallActivity.java
(...)
private void setupLayout() {
// Create Adapter
// (...)
listView.setAdapter(fbPostAdapter);
// Subscribe on provider changes.
homeProvider.getObservable().subscribe(new Observer<FbPost>() {