This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private final Log logger = LogFactory.getLog(getClass()); | |
public void given_i_need_a_github_name() { | |
List<String> names = getNamePerms(6); | |
for (String name : names) { | |
System.out.print('.'); | |
RestTemplate restTemplate = new RestTemplate(); | |
String url = "http://github.com/" + name; | |
ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.GET, null, String.class); | |
if (response.hasBody() && response.getBody().contains("This is not the web page you are looking for")) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Bitmap addGradient(Bitmap src, @ColorInt int start, @ColorInt int end, int alpha) { | |
int w = src.getWidth(); | |
int h = src.getHeight(); | |
Bitmap overlay = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888); | |
Canvas canvas = new Canvas(overlay); | |
canvas.drawBitmap(src, 0, 0, null); | |
Paint paint = new Paint(); | |
LinearGradient shader = new LinearGradient(0, 0, 0, h, start, end, Shader.TileMode.CLAMP); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.graphics.Rect; | |
import android.support.v7.widget.RecyclerView; | |
import android.view.View; | |
/** | |
* Created by markhetherington on 15-08-17. | |
*/ | |
public class SpacesItemDecoration extends RecyclerView.ItemDecoration { | |
private int halfSpace; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static String printInsides(Object object) { | |
StringBuilder result = new StringBuilder(); | |
String newLine = "\n"; | |
result.append( object.getClass().getName() ); | |
result.append( " Object { " ); | |
result.append(newLine); | |
//determine fields declared in this class only (no fields of superclass) | |
Field[] fields = object.getClass().getDeclaredFields(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { | |
int height = 0; | |
for(int i = 0; i < getChildCount(); i++) { | |
View child = getChildAt(i); | |
child.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)); | |
int h = child.getMeasuredHeight(); | |
if(h > height) height = h; | |
} |
NewerOlder