Skip to content

Instantly share code, notes, and snippets.

# If you come from bash you might have to change your $PATH
export ANDROID_HOME=$HOME/Library/Android/sdk/
export PATH=$HOME/bin:/usr/local/bin:$HOME/Library/Python/2.7/bin:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools:$PATH
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
# Path to your oh-my-zsh installation.
export ZSH="/Users/aleksandrsobol/.oh-my-zsh"
image: openjdk:8-jdk
stages:
- build
- package
####################################################################################################
# BUILD
#
data class Chat(
@SerializedName("chat_id") val chatId: String,
@SerializedName("created_at") val createdAt: Long,
@SerializedName("updated_at") val updatedAt: Long,
@SerializedName("creator_id") val creatorId: String,
@SerializedName("recipients") val recipients: List<String>,
@SerializedName("unread_messages") val unreadMessages: Int,
@SerializedName("last_message_id") val lastMessageId: String,
@SerializedName("last_message") val lastMessage: String,
@SerializedName("last_message_timestamp") val lastMessageTimeStamp: Long,
05-30 23:52:14.445 6225-6225/com.motoris.motorist D/ChatListPresenter: new_chat: {
"chat_id": "chat_id",
"created_at": 13432543245325532,
"recipients": [
"rec1",
"rec2",
"rec3"
]
}
05-30 23:52:14.446 6225-6225/com.motoris.motorist D/ChatListPresenter: text_payload: {
enum class EnvelopeType {
CHAT_MESSAGE, CHAT_NEW, MESSAGE_STATUS, CHAT_UPDATED
}
enum class PayloadType {
TEXT_MESSAGE, IMAGE_MESSAGE
}
enum class MessageStatusType {
FAILED, SENDING, DELIVERED_TO_SERVER, DELIVERED_TO_RECIPIENT, READED, DELETED
Observables.combineWithUnit(checkedProducts, view.confirmReplacement())
.switchMap { interactor.confirmReplacement(orderId, DenyCourierOrderRequest(it)) }
.subscribe { response -> response.fold(view::showError, { Timber.d("confirmed!!!!") }) }
fun <T> combineWithUnit(o1: Observable<T>, o2: Observable<Unit>): Observable<T>
= Observable.combineLatest(o1, o2, BiFunction { t1, _ -> t1 })
val checkedProducts = view.checkProduct()
.scan(ArrayList<String>(), {acc, next -> acc.add(next); acc})
.publish()
Observable personsObs =
Observable
.from(personList)
.reduce(new ArrayList<Person>(), (acc, person) -> {
person.setInPhonebook(isInPhonebook);
person.setAccessoryType(accessoryType);
acc.add(person);
return acc;
})
.map(personDao::save);
@xsobolx
xsobolx / Retrofit-gzip-interceptor
Created August 17, 2016 08:25
Retrofit gzip interceptor with content length
class GzipRequestInterceptor implements Interceptor {
@Override public Response intercept(Chain chain) throws IOException {
Request originalRequest = chain.request();
if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) {
return chain.proceed(originalRequest);
}
Request compressedRequest = originalRequest.newBuilder()
.header("Content-Encoding", "gzip")
.method(originalRequest.method(), forceContentLength(gzip(originalRequest.body())))
@xsobolx
xsobolx / 0_reuse_code.js
Created July 7, 2014 12:31
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console