Skip to content

Instantly share code, notes, and snippets.

private void setupLayout() {
// Create Adapter
// (...)
// Subscribe on provider changes.
homeProvider.getObservable().subscribe(new Observer<FbPost>() {
public class LoginActivity extends Activity {
private EditText mEmailEdit;
private EditText mPassword;
private Button btnSend;
private EditText mPhoneNumber;
private TextWatcher watcher;
protected void onCreate(Bundle savedInstanceState) {
public class FacebookHomeProvider {
protected final PublishSubject<FbPost> behaviorSubject;
private Request request;
public FacebookHomeProvider() {
behaviorSubject = PublishSubject.create();
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;
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
lgvalle / step2.js
Last active Aug 8, 2017
Post: Take control of your backend (II)
View step2.js
const Client = require('node - rest - client').Client
const client = new Client()
exports.fetch = functions.https.onRequest((req, res) => {
client.get(BACKEND_URL, function (data, response) {
() // TODO Clean up
return res.status(200)
.type('application / json')
View raw_response.xml
<rss xmlns:media=”" xmlns:dc=”" version=”2.0">
 <title>London | The Guardian</title>
 <description>Latest news and features from, the world’s leading liberal voice</description>
 <copyright>Guardian News and Media Limited or its affiliated companies. All rights reserved. 2017</copyright>
 <pubDate>Mon, 31 Jul 2017 15:32:49 GMT</pubDate>
View step4.js
function cleanUp(data) {
// Empty array to add cleaned up elements to
const items = []
// We are only interested in children of the 'channel' element
const channel =
channel.item.forEach(element => {
item = {
title: element.title,
description: element.description,
View tidy_up_response.json
"title": "'Leaving London means I can afford kids': readers on why the capital lost its sparkle",
"description": "Almost 100,000 Londoners moved out last year. Here they, and others who are avoiding the city altogether, explain why it is no longer the place to be&lt;br&gt;&lt;/p&gt;&lt;p&gt;The rate of Londoners leaving the capital is more than &lt;a href=""&gt;80% higher than five years ago&lt;/a&gt;, according to Savills, with people in their thirties the age group most likely to leave. &lt;/p&gt;&lt;p&gt;We asked readers why they’re leaving London, or avoiding moving to the capital altogether. Here’s what you said:&lt;/p&gt;&lt;p&gt;All my salary was being spent on living costs in London&lt;/p&gt; &lt;a href=""&gt;Continue reading...&lt;/a&gt;",
"date": "Mon, 31 Jul 2
View docker-compose.yml
version: '3'
image: rethinkdb:2.3
- "8080:8080"
- "28015:28015"
- "29015:29015"
restart: always