See SO answer.
You can pan (click background), zoom (mousewheel), drag nodes around. Middle click to add more nodes (at mouse).
public static boolean isFOSHoldingOnToFile() { | |
return !canDeleteCreatedFile() || !canRenameCreatedFile(); | |
} | |
public static boolean canDeleteCreatedFile() { | |
File temp = null; | |
try { | |
temp = File.createTempFile("canDeleteCreatedFile", null, Robolectric.application.getCacheDir()); | |
if(!temp.delete()) { | |
return false; |
import java.io.File; | |
import android.content.Context; | |
import com.bumptech.glide.load.engine.cache.*; | |
public final class ExternalCacheDiskCacheFactory implements DiskCache.Factory { | |
private final Context context; | |
private final String diskCacheName; | |
private final int diskCacheSize; | |
public ExternalCacheDiskCacheFactory(Context context, int diskCacheSize) { |
class DrawableResoureDecoder implements ResourceDecoder<Drawable, Drawable> { | |
@Override public Resource<Drawable> decode(Drawable source, int width, int height) throws IOException { | |
return new DrawableResource<Drawable>(source) { | |
@Override public int getSize() { return 1; } | |
@Override public void recycle() { } | |
}; | |
} | |
@Override public String getId() { return "DrawableDrawableResourceDecoder"; } | |
} |
static { | |
System.setOut(new java.io.PrintStream(new java.io.FilterOutputStream(System.out) { | |
int count = 10 * 1024; | |
@Override public void write(int b) throws IOException { | |
if (count > 0) { | |
super.write(b); | |
--count; | |
} | |
} | |
@Override public void write(byte[] b, int off, int len) throws IOException { |
package problems.tushar; | |
import java.util.*; | |
import java.util.function.Predicate; | |
import java.util.stream.*; | |
import static problems.tushar.TravelingSalesmanHeldKarpX.Algo.*; | |
import static problems.tushar.TravelingSalesmanHeldKarpX.Utils.*; | |
/** |
class DrawableBitmapResourceDecoder implements ResourceDecoder<Drawable, Bitmap> { | |
private final BitmapPool pool; | |
public DrawableBitmapResourceDecoder(Context context) { | |
this(Glide.get(context).getBitmapPool()); | |
} | |
public DrawableBitmapResourceDecoder(BitmapPool pool) { | |
this.pool = pool; | |
} | |
@Override public Resource<Bitmap> decode(Drawable drawable, int width, int height) throws IOException { |
See SO answer.
You can pan (click background), zoom (mousewheel), drag nodes around. Middle click to add more nodes (at mouse).
public class Example { | |
public static <T1, T2> Predicate<Pair<T1, T2>> expand(BiPredicate<? super T1, ? super T2> func) { | |
return objects -> func.test(objects.getValue0(), objects.getValue1()); | |
} | |
} |
http://angular.github.io/protractor/#/api
Note: Most commands return promises, so you only resolve their values through using jasmine expect API or using .then(()=>{}) structure
Based on this post: https://spagettikoodi.wordpress.com/2015/01/14/angular-testing-cheat-sheet/ by @crystoll
and updated for ES6/jasmine2
allProjects { project -> | |
tasks.withType(JavaCompile).configureEach { JavaCompile task -> | |
task.doFirst { | |
// annotationProcessorPath is populated around afterEvaluate, but can't use that in configureEach | |
if (hasDagger(task.options.annotationProcessorPath)) { | |
task.options.compilerArgs += [ | |
// disable formatting, why wait if it looks almost the same?! | |
'-Adagger.formatGeneratedSource=disabled' | |
] | |
} |