Instead of the verbose setOnClickListener
:
RxView.clicks(submitButton).subscribe(o -> log("submit button clicked!"));
Observable
.just(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
# Default setup is given for MySQL with ruby1.8. If you're running Redmine | |
# with MySQL and ruby1.9, replace the adapter name with `mysql2`. | |
# Examples for PostgreSQL and SQLite3 can be found at the end. | |
production: | |
adapter: mysql2 | |
database: redmine | |
host: localhost | |
username: redmine | |
password: ****** |
/** | |
* Created by Nikola D. on 3/9/2016. | |
*/ | |
public abstract class BaseFilterPerformer<T> implements FilterOnSubscribe.FilterPerformer<T> { | |
public FilterOnSubscribe.FilteringResult<T> createFilterResult(T data) { | |
FilterOnSubscribe.FilteringResult<T> filteringResult = new FilterOnSubscribe.FilteringResult<>(); | |
filteringResult.data = data; | |
return filteringResult; |
Source: StackOverflow, StackOverflow, Blog
Requirement: we will create a custom ViewPager
class that allow enable/disable spiwing. This ViewPager
contains 3 fragments MyCameraFragment
, PhotoFragment
, MissionFragment
. The MyCameraFragment
is the special one. We will need to enable auto orientation (sensor) only for this fragment.
Answer:
MyViewPager
public class MyViewPager extends ViewPager {
import android.content.Context; | |
import android.content.res.TypedArray; | |
import android.graphics.Typeface; | |
import android.support.design.widget.TextInputLayout; | |
import android.util.AttributeSet; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import android.widget.EditText; | |
import uk.co.chrisjenx.calligraphy.CalligraphyConfig; |
Enter Chat and press enter | |
<div><input id=input placeholder=you-chat-here /></div> | |
Chat Output | |
<div id=box></div> | |
<script src=http://cdn.pubnub.com/pubnub.min.js></script> | |
<script>(function(){ | |
var pubnub = PUBNUB.init({publish_key:'demo',subscribe_key:'demo',ssl:true}); | |
var box = PUBNUB.$('box'), input = PUBNUB.$('input'), channel = 'chat'; |
<RelativeLayout | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<Spinner | |
android:id="@+id/subject_spinner" | |
android:layout_width="1dp" | |
android:layout_height="1dp" | |
android:layout_alignParentTop="true" | |
android:layout_centerHorizontal="true" |
<link href="http://yandex.st/highlightjs/7.0/styles/default.min.css" rel="stylesheet"> | |
<script src="http://yandex.st/highlightjs/7.0/highlight.min.js"></script> | |
<script type='text/javascript'> $(document).ready(function() { | |
function fixup(s) { | |
var re1 = new RegExp('<','g'), re2 = new RegExp('>','g'); | |
return s.replace(re1,'<').replace(re2,'>'); | |
} | |
$.ajax({type: "GET", | |
url: "https://api.github.com/gists/5617520", |
fun Any?.toHashMap(): HashMap<String, RequestBody> { | |
val map = HashMap<String, RequestBody>() | |
if(this == null){ | |
return map | |
} | |
for (field in this.javaClass.declaredFields) { | |
val temp = field.isAccessible | |
field.isAccessible = true |
package kr.changhoonjin.testmvp.view_models; | |
import android.databinding.ObservableBoolean; | |
import android.databinding.ObservableField; | |
import android.databinding.ObservableInt; | |
import android.text.Editable; | |
import android.text.TextUtils; | |
import android.text.TextWatcher; | |
import android.util.Log; | |
import android.util.Patterns; |