Skip to content

Instantly share code, notes, and snippets.

Avatar

Romain Piel romainpiel

  • Toulouse, France
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am romainpiel on github.
  • I am romainpiel (https://keybase.io/romainpiel) on keybase.
  • I have a public key ASDTs1Gwct_YKWxqt4nVCNu9RTcOJMat6_AWY0qb4quJIwo

To claim this, I am signing this object:

View AccessTokenCreator.java
package com.facebook;
import java.util.ArrayList;
import java.util.Collection;
public class AccessTokenCreator {
public static AccessToken createToken(Collection<String> grantedPermissions) {
return new AccessToken("token", "appId", "userId", grantedPermissions,
new ArrayList<String>(), AccessTokenSource.WEB_VIEW, null, null);
@romainpiel
romainpiel / build.gradle
Created Mar 8, 2016
Start/stop genymotion devices just to run the tests
View build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.genymotion:plugin:1.0'
}
}
apply plugin: "genymotion"
View RxBus.java
import rx.Subscription;
import rx.android.schedulers.AndroidSchedulers;
import rx.subjects.PublishSubject;
import rx.functions.Action1;
public class RxBus {
public enum Key {
VAL_1, VAL_2
}
View LoggingInterceptor.java
import android.util.Log;
import com.squareup.okhttp.Headers;
import com.squareup.okhttp.Interceptor;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;
import com.squareup.okhttp.ResponseBody;
import org.threeten.bp.Clock;
@romainpiel
romainpiel / MyTest.java
Last active Aug 13, 2019
Source for https://medium.com/p/3f6f4179652e - "RecyclerView and espresso, a complicated story"
View MyTest.java
RecyclerViewInteraction.<Item>onRecyclerView(withId(R.id.recyclerview))
.withItems(items)
.check(new ItemViewAssertion<Item>() {
@Override
public void check(Item item, View view, NoMatchingViewException e) {
matches(hasDescendant(withText(item.getDisplayName())))
.check(view, e);
}
});
View gist:a944add07dd369c8b642
dependencies {
classpath 'com.github.castorflex.manifestreplace:plugin:1.0.0'
}
apply plugin: 'com.android.application'
apply plugin: 'manifestreplace'
manifestReplace {
manifestPlaceholders = [
activities : [
@romainpiel
romainpiel / HLog.java
Last active Aug 29, 2015
A wrapper around Android Log class to show the calling method as a hyperlink in Android Studio
View HLog.java
package com.example.myapplication;
import android.util.Log;
/**
* HLog
* romainpiel
* 13/09/2014
*/
public class HLog {
@romainpiel
romainpiel / better-android-res.md
Last active Oct 3, 2017
Better Android xml resources
View better-android-res.md

Better Android xml resources

Even though I think Android xml res/ are very powerful, sometimes I have the feeling that it could be improved. But how could it be enhanced? In an empty world where you have the full power to do whatever you want, what would you do? Here is a list of ideas that came to my mind.

Ideas

Dimension operations

One thing I miss from Sass or Less is a way to use operators.

@romainpiel
romainpiel / WireHelper.java
Last active Jan 3, 2017
Square wire - handling default values
View WireHelper.java
public static <T extends Message> T getDefault(Class<T> type) {
if (type == null) {
return null;
}
// Create Builder instance
Class builderType = null;
Message.Builder<T> msgBuilder = null;
try {
You can’t perform that action at this time.