Skip to content

Instantly share code, notes, and snippets.

View mochadwi's full-sized avatar
💭
I may be slow to respond.

Mochamad Iqbal Dwi Cahyo mochadwi

💭
I may be slow to respond.
View GitHub Profile
@letsspeak
letsspeak / database.yml
Created October 30, 2012 17:41
Redmine on unicorn on nginx with mysql, my configuration files.
# 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: ******
@NikolaDespotoski
NikolaDespotoski / BaseFilterPerformer.java
Created March 9, 2016 09:31
RxJava Filter implementation for ListView or RecyclerView
/**
* 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;
@ZacSweers
ZacSweers / RxJava.md
Last active September 3, 2018 18:52 — forked from cesarferreira/RxJava.md
Party tricks with RxJava, RxAndroid & Retrolambda

View Click

Instead of the verbose setOnClickListener:

RxView.clicks(submitButton).subscribe(o -> log("submit button clicked!"));

Filter even numbers

Observable
    .just(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
@vxhviet
vxhviet / viewPager.md
Last active October 23, 2018 03:41
Android Fragment + ViewPager

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 {
@kassim
kassim / CalligraphyTextInputLayout.java
Last active October 25, 2018 03:25
TextInputLayout for use with Calligraphy that supports a fontPath defined by the hintTextAppearance attribute
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;
@stephenlb
stephenlb / 1.html
Last active October 27, 2018 05:10 — forked from ToeJamson/1.js
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';
@erayakartuna
erayakartuna / Spinner_material_design.xml
Last active January 22, 2019 19:05
Android Material Design Widget Spinner
<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"
@DinoChiesa
DinoChiesa / Embedding-Gist.htm
Created May 22, 2013 02:24
Embed a Gist using jQuery.
<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,'&lt;').replace(re2,'&gt;');
}
$.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
@NunciosChums
NunciosChums / Second.java
Created March 7, 2017 02:56
EditText validation in MVVM
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;