Skip to content

Instantly share code, notes, and snippets.

@daschl
daschl / gist:db9fcc9d2b932115b679
Last active August 26, 2020 23:17
Draft: Writing Code for Production

Writing Resilient Reactive Applications

This guide is a first draft (that will end up in the official docs) on writing resilient code for production with the Couchbase Java SDK. At the end, the reader will be able to write code that withstands bugs, latency issues or anything else that can make their application fail.

Note that lots of concepts can be applied for both synchronous and asynchronous access. When necessary, both patterns are discussed separately. Also, the focus is on database interaction, but if you are using RxJava as part of your stack you can apply most of the principles there as well (and should!).

RxJava 101 Recap: Cold and Hot Observables

When working with Observables, it is important to understand the difference between cold and hot. Cold Observables will start to emit events once a Observer subscribes, and will do it "fresh" for each Observer. Hot Observables instead are starting to emit data as soon as it becomes available, and will return the same (or parts of the same)

@UnderGreen
UnderGreen / installation.rst
Last active October 29, 2020 12:52 — forked from marcinkuzminski/installation.rst
Installation instruction for Kallithea

Setting up Kallithea on Ubuntu Server 12.04

Preparation

  1. Install Ubuntu Server.
  2. Update Ubuntu with the commands:
@jaredhirsch
jaredhirsch / gist:4971859
Created February 17, 2013 15:19
all about ETags

ETags: a pretty sweet feature of HTTP 1.1

HTTP caching review

HTTP provides two ways for servers to control client-side caching of page components:

  • freshness may be based on a date or a token whose meaning is app-specific
  • whether or not the client needs to confirm the cached version is up-to-date with the server

This breaks down as follows:

  • Cache locally and don't check before using.
@justo
justo / atom-invisibles-override.less
Created December 9, 2015 20:56
Style to make Atom's tab character a wide line like Sublime Text and to only show invisibles on document highlight.
atom-text-editor::shadow {
/**
* Put this in your Atom stylesheet to replace the tab character with
* a full-width line like in Sublime Text. Change the background color
* to match your theme.
*
* Open your Atom settings and under "Editor Settings" change your
* "Invisbles Tab" field to a single space (" "). Otherwise you will see
* both tab indicators.
*/
@shrikant0013
shrikant0013 / GestureMediaPlayerActivity.java
Created November 4, 2016 04:55
Android example for code that needs to change settings (Manifest.permission.WRITE_SETTINGS), targetSdkVersion >= 23
/**
* Created by spandhare on 11/3/16.
*/
import com.malmstein.fenster.controller.FensterPlayerControllerVisibilityListener;
import com.malmstein.fenster.play.FensterVideoFragment;
import android.Manifest;
import android.content.Intent;
import android.net.Uri;
@gabrielemariotti
gabrielemariotti / README.md
Last active February 24, 2021 10:52
How to manage the support libraries in a multi-module projects. Thanks to Fernando Cejas (http://fernandocejas.com/)

Centralize the support libraries dependencies in gradle

Working with multi-modules project, it is very useful to centralize the dependencies, especially the support libraries.

A very good way is to separate gradle build files, defining something like:

root
  --gradleScript
 ----dependencies.gradle
@mohsin
mohsin / StringUtils.java
Last active April 11, 2021 13:40
Function to convert Android menu.xml into string array for use in ArrayAdapter for NavigationDrawer
import android.view.Menu;
import android.view.MenuInflater;
import android.content.Context;
import android.support.v7.view.menu.MenuBuilder;
public class StringUtils {
/*
* Usage: String[] mMenuItems = StringUtils.getArrayFromMenu(this, R.menu.menu_main);
* And then mDrawerList.setAdapter(new ArrayAdapter<>(this, R.layout.item_listview_drawer, mMenuItems));
@nisrulz
nisrulz / grayscale_imageview.java
Created December 25, 2015 05:52
Apply grayscale filter to ImageView in android
ImageView imgview = (ImageView)findViewById(R.id.imageView_grayscale);
imgview.setImageBitmap(bitmap);
// Apply grayscale filter
ColorMatrix matrix = new ColorMatrix();
matrix.setSaturation(0);
ColorMatrixColorFilter filter = new ColorMatrixColorFilter(matrix);
imgview.setColorFilter(filter);
@Shipaaaa
Shipaaaa / Knock_Knock!_Who_s_there?_Open.md
Last active July 2, 2021 07:07
Источники и полезные материалы к докладу "Тук-тук! Кто там? Открыто…"