Skip to content

Instantly share code, notes, and snippets.

View jeanPokou's full-sized avatar

jean POKOU jeanPokou

View GitHub Profile
@searls
searls / Email.java
Created March 10, 2011 15:12
An example of behavior verification + argument capture with Mockito (on TestNG)
package com.pillartechnology.mail;
import java.util.Date;
public class Email {
private String domain;
private String user;
private String body;
@pawl
pawl / example.html
Created December 30, 2014 10:59
Flask Inline Editing Example Using WTForms + X-Editable
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>title</title>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet">
<link href="//cdnjs.cloudflare.com/ajax/libs/x-editable/1.5.0/bootstrap3-editable/css/bootstrap-editable.css" rel="stylesheet"/>
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
package <your package>;
import java.util.ArrayList;
import org.json.JSONException;
import org.json.JSONObject;
import za.co.smartcitizens.trafficlights.spotter.models.LastKnownUserPosition;
import za.co.smartcitizens.trafficlights.spotter.models.TrafficLightIntersectionGeofence;
import android.content.Context;
@crazyhitty
crazyhitty / issue_with_rx_room_flowable.md
Last active March 18, 2020 18:31
Issues with RxRoom and Flowable

In RxRoom, Flowable will always emit atleast one item, so using single() and isEmpty() functions won't work as expected.

So, the one where you are checking if projects are cached or not using isEmpty() function, room will still emit one item which would be an empty list object. This happens because even if no values exist in db, Room will still create an empty list first and then try to populate it if any items exist. Finally, it would emit the list object even if it is empty.

You can resolve this issue by updating the areProjectsCached() function in ProjectsCacheImpl.kt like this:

override fun areProjectsCached(): Single<Boolean> =
    projectsDatabase.cachedProjectsDao()
 .getProjects()
@osipxd
osipxd / .editorconfig
Last active September 9, 2024 19:11
EditorConfig for Android projects with mapping to IntelliJ IDEA's config
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
max_line_length = 120