Skip to content

Instantly share code, notes, and snippets.

@miszmaniac
miszmaniac / Traits - example
Created May 13, 2013 05:46
Próbka - jak można użyć Traitów w widokach.
<?
trait FormElements {
protected function getLabel($text, $for) {
return "<label for='$for'>$text</label>";
}
protected function getTextInput($name) {
return "<input type='text' name='$name'/>";
}
@miszmaniac
miszmaniac / NestedScrollViewScrollToAction.java
Created September 12, 2016 12:48
NestedScrollViewScrollToAction because regular ScrollTo doesn't work
package com.example.NestedScrollViewScrollToAction;
import android.graphics.Rect;
import android.support.design.widget.CoordinatorLayout;
import android.support.test.espresso.PerformException;
import android.support.test.espresso.UiController;
import android.support.test.espresso.ViewAction;
import android.support.test.espresso.matcher.ViewMatchers.Visibility;
import android.support.test.espresso.util.HumanReadables;
import android.support.v4.widget.NestedScrollView;
class PublishSubjectMergeUsage {
PublishSubject<List<Car>> cars = PublishSubject.create(...); //Car has some Id
PublishSubject<List<Wheel>> wheels = PublishSubject.create(...); //Wheel have carId which is
public Observable<List<CarWithWheels>> test(Observable<List<Car>> cars, Observable<List<Wheel>> wheels) {
return Observable.combineLatest(
cars.flatMapIterable(c -> c),
class User {
public int id;
public User(int id) {
this.id = id;
}
}