Skip to content

Instantly share code, notes, and snippets.

View pyricau's full-sized avatar

py - Pierre Yves Ricau pyricau

View GitHub Profile
@pyricau
pyricau / Strip.java
Created May 20, 2012 09:37
Stripping html tags from a String
public class Strip {
public static void main(String[] args) {
// outputs "Hello world!"
System.out.println(stripHtmlTags("Hello <b>world</b><img src='somewhere'/>!"));
}
public static String stripHtmlTags(String input) {
StringBuilder sb = new StringBuilder(input.length());

Current implementation of findViewById() :

public class View {

    public final View findViewById(int id) {
        if (id < 0) {
            return null;
        }
 return findViewTraversal(id);
@pyricau
pyricau / gist:5330096
Created April 7, 2013 11:25
Nice stacktrace on airfrance.us !
JSP Processing Error
HTTP Error Code: 500
Error Message:
JSPG0049E: /US/fr/local/rebooking/standard/rbk_standard_recap.jsp failed to compile :
JSPG0091E: An error occurred at line: 403 in the file: /US/fr/local/rebooking/standard/rbk_standard_recap.jsp
JSPG0093E: Generated servlet error from file: /US/fr/local/rebooking/standard/rbk_standard_recap.jsp
/exploit/was6/prd/cells/ASQVIPB2CB01/temp/qvipb2cb01n7/WVPB2CB01b2c_bServer_n7s4/WVPB2CB01b2c_b_B2CEAR_App/B2CWeb.war/US/fr/local/rebooking/standard/_rbk_5F_standard_5F_recap.java : 2291 : The method isConfirmationRecap() is undefined for the type RecapRbkDisplayBean
JSPG0091E: An error occurred at line: 816 in the file: /US/fr/local/rebooking/standard/rbk_standard_recap.jsp
@pyricau
pyricau / Test.java
Created December 10, 2013 22:41
Does this compile? Why?
import java.util.List;
public class Test<T> {
public static String getFirst(Test test) {
return test.strings.get(0);
}
List<String> strings;
}
@pyricau
pyricau / AA_Devoxx_CFP
Created July 5, 2012 15:44
Android DDD (Diet Driven Development)!
Android DDD (Diet Driven Development)!
Is your Android code growing big and fat?
It's time for a slim down: with AndroidAnnotations, you will lose 42% LOC in a few hours, money-back guaranteed! Oh, by the way... it's
Open Source!
Try it now, it works!
Why are we writing the same Android code over and over again? Why are our apps harder and harder to maintain? Context and Activity god
dependencies {
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.1'
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.1'
// Optional, if you use support library fragments:
debugImplementation 'com.squareup.leakcanary:leakcanary-support-fragment:1.6.1'
}
@pyricau
pyricau / gist:8becbc14aeb670368ff8
Created July 22, 2015 05:13
System class roots
GC Roots: 242256
System class root total: 197490 real: 90556 undefined: 106934
============
Undefined System Class roots:
long[] of size 65200: 26310
java.lang.Class[] of size 7570: 26310
java.lang.Class[] of size 3405: 12342
long[] of size 32034: 12342
long[] of size 29221: 10101
java.lang.Class[] of size 3097: 10101
@pyricau
pyricau / DrawableUtils.java
Created July 10, 2012 08:02
Android Repeated Texture Fix
public class DrawableUtils {
/**
* @see #fixTexturesInLayerDrawable(Drawable)
*/
public static void fixBackgroundTextures(View view) {
fixTexturesInLayerDrawable(view.getBackground());
}
/**
@pyricau
pyricau / ConvertirRepoSvnGit
Created July 28, 2011 09:55
Convertir un repo SVN en repo Git, avec ceintures et bretelles
# On sort la liste des users ayant commité sur le SVN
svn log --xml https://svn.codehaus.org/groovy | grep "<author>" | sort -u | sed 's/<[^>]*[>]//g' > users.txt
# Compléter le fichier users.txt pour qu'il ait le format suivant (sur certains SVN, le "no author" correspond au premier commit) :
user1 = User One <user1@mail.com>
user2 = User Two <user2@mail.com>
(no author) = No Author <no@author.com>
# Cloner en local le repo svn (je pars du principe que le svn a la forme classique trunk / branches / tags
git svn clone --username glaforge --stdlayout --no-metadata --authors-file users.txt https://svn.codehaus.org/groovy groovy
import java.util.concurrent.Callable;
public enum Lol implements Callable<CharSequence> {
ಠ_ಠ {
@Override public String call() {
return "Foo";
}
};