interface RestApi {
@Multipart
@Headers({"Accept:text/plain"})
@POST(value = "/j_spring_security_check")
Call<com.squareup.okhttp.Response> authenticate(
@Part(value = "username") String username,
@Part(value = "password") String password
@PartMap Map<String, String> params);
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(".itform .send").click(function(){ | |
var form = $(this).parents(".itform"); | |
var email = form.find('input[name="email"]').val(); | |
var name = form.find('input[name="name"]').val().trim(); | |
var phone = form.find('input[name="phone"]').val().trim(); | |
var regEmail = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; | |
var regPhone = /^((\+38)[\-]?)?(\(?\d{3}\)?[\- ]?)?[\d\- ]{7,10}$/ | |
var emailError = form.find('#errorMess'); | |
var nameError = form.find('#errorName'); | |
var phoneError = form.find('#errorPhone'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface RealmWrapper { | |
Observable<Realm> asObservable(); | |
<E extends RealmModel> void createAllFromJson(Class<E> clazz, JSONArray json); | |
<E extends RealmModel> void createOrUpdateAllFromJson(Class<E> clazz, JSONArray json); | |
<E extends RealmModel> void createAllFromJson(Class<E> clazz, String json); | |
<E extends RealmModel> void createOrUpdateAllFromJson(Class<E> clazz, String json); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Job { | |
private final long interval; | |
private final String tag; | |
Job(Builder builder) { | |
this.interval = builder.interval; | |
this.tag = builder.tag; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import kotlinx.coroutines.experimental.launch | |
import kotlinx.coroutines.experimental.android.UI | |
import kotlinx.coroutines.experimental.async | |
class Model : ViewModel() { | |
fun load() { | |
launch(UI) { | |
// Start 3 calls in parallel | |
val response1 = api.makeAcall() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import kotlinx.coroutines.experimental.CoroutineScope | |
import kotlinx.coroutines.experimental.CoroutineStart | |
import kotlinx.coroutines.experimental.DefaultDispatcher | |
import kotlinx.coroutines.experimental.Job | |
import kotlin.coroutines.experimental.CoroutineContext | |
import kotlinx.coroutines.experimental.launch as coroutineLaunch | |
/** | |
* Acts as dependency provider. Later used in the test env to provide suspendable UI tests. | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import kotlinx.coroutines.experimental.launch | |
import kotlinx.coroutines.experimental.android.UI | |
import kotlinx.coroutines.experimental.async | |
class Model(private val coroutines: CoroutinesProvider) : ViewModel() { | |
fun load() { | |
coroutines.launch(UI) { | |
// Start 3 calls in parallel | |
val response1 = api.makeAcall() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.support.test.espresso.IdlingRegistry | |
import android.support.test.espresso.IdlingResource | |
import kotlinx.coroutines.experimental.CoroutineScope | |
import kotlinx.coroutines.experimental.CoroutineStart | |
import kotlinx.coroutines.experimental.Job | |
import org.junit.rules.TestRule | |
import org.junit.runner.Description | |
import org.junit.runners.model.Statement | |
import kotlin.coroutines.experimental.CoroutineContext |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.support.test.espresso.Espresso.onView | |
import android.support.test.espresso.assertion.ViewAssertions.matches | |
import android.support.test.espresso.matcher.ViewMatchers.* | |
import android.support.test.runner.AndroidJUnit4 | |
import android.view.View | |
import org.junit.Rule | |
import org.junit.Test | |
import org.junit.runner.RunWith | |
// https://gist.github.com/tomkoptel/1101b2bb61f3daf251e3d627ee533b92 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.support.test.espresso.IdlingResource | |
import co.metalab.asyncawait.onIdleCoroutines | |
import co.metalab.asyncawait.onRunningCoroutine | |
class AsyncIdlingResource : IdlingResource { | |
private var areCoroutinesIdle = true | |
private var callback: IdlingResource.ResourceCallback? = null | |
override fun getName(): String = "AsyncIdlingResource" |
OlderNewer