(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| package com.andraskindler.sandbox.activity; | |
| import retrofit.RestAdapter; | |
| import retrofit.http.GET; | |
| import retrofit.http.Query; | |
| import rx.Observable; | |
| import rx.Subscriber; | |
| import rx.schedulers.Schedulers; | |
| public class ApiManager { |
| task robolectric(type: Test, dependsOn: assembleRelease) { | |
| testClassesDir = sourceSets.robolectric.output.classesDir | |
| android.sourceSets.main.java.srcDirs.each { dir -> | |
| project.getPlugins().getPlugin('android').prepareTaskMap.each { | |
| sourceSets.robolectric.compileClasspath += files(it.value.explodedDir.getAbsolutePath() + '/classes.jar') | |
| sourceSets.robolectric.runtimeClasspath += files(it.value.explodedDir.getAbsolutePath() + '/classes.jar') | |
| } |
| <?php | |
| /** | |
| * All custom functions should be defined in this class | |
| * and tied to WP hooks/filters w/in the constructor method | |
| */ | |
| class Custom_Functions { | |
| // Custom metaboxes and fields configuration |
| public class FacebookHomeProvider { | |
| protected final PublishSubject<FbPost> behaviorSubject; | |
| private Request request; | |
| public FacebookHomeProvider() { | |
| behaviorSubject = PublishSubject.create(); | |
| behaviorSubject.subscribeOn(Schedulers.io()); | |
| } | |
| /** |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| def toCamelCase(String string) { | |
| String result = "" | |
| string.findAll("[^\\W]+") { String word -> | |
| result += word.capitalize() | |
| } | |
| return result | |
| } | |
| afterEvaluate { project -> | |
| Configuration runtimeConfiguration = project.configurations.getByName('compile') |
| You can add this to your shell profile and then use it as dexcount file. | |
| This file should have a classes.dex in order to work, that means it has to be a android lib project or android apk. | |
| count(){ | |
| mkdir temp >/dev/null | |
| cp $1 temp/$1+copy > /dev/null | |
| unzip temp/$1+copy -d temp/ > /dev/null | |
| cat temp/classes.dex | head -c 92 | tail -c 4 | hexdump -e '1/4 "%d\n"' | |
| rm -R temp > /dev/null | |
| } |
| public class ParallaxPageTransformer implements ViewPager.PageTransformer { | |
| public void transformPage(View view, float position) { | |
| int pageWidth = view.getWidth(); | |
| if (position < -1) { // [-Infinity,-1) | |
| // This page is way off-screen to the left. | |
| view.setAlpha(1); |
| ###################################################### | |
| # Proguard file to remove debug logs and NOT kill the application | |
| # | |
| # @benclayton github.com/benvium 15-12-2014 | |
| # | |
| # https://gist.github.com/benvium/8995326bc944f47f2c64 | |
| ###################################################### | |
| # To use this file, your project's build.gradle 'buildTypes' section should look like this: | |
| # |
| import android.annotation.SuppressLint; | |
| import android.os.Build; | |
| import android.os.Bundle; | |
| import android.support.v7.app.ActionBarActivity; | |
| import android.util.Log; | |
| import android.view.View; | |
| import android.view.ViewGroup; | |
| import android.view.ViewTreeObserver; | |
| import com.google.android.gms.maps.GoogleMap; |