Skip to content

Instantly share code, notes, and snippets.

package org.test;
import org.junit.Test;
import javax.tools.*;
import java.io.ByteArrayOutputStream;
import java.lang.reflect.InvocationTargetException;
import java.net.URI;
import java.util.*;
public class Tester extends SuperClass {
private SuperCaller superCaller = new SuperCaller();
private Delegate delegate = new Delegate(superCaller);
public static void main(String[] args){
Tester tester = new Tester();
tester.runMe();
}
public class AnnotationProcessorOutputAssertion {
public @interface Target {}
public interface TestTarget {
String get();
}
@Test
public void testCompileAnnotationProcessorOutput() throws InstantiationException, IllegalAccessException, ClassNotFoundException, IOException {
Synconrized(Scopes.class):
public class Scopes {
public static <T> T getObject(ScopeSource source, Class<T> clazz, ScopedBuilder<T> builder){
T result = source.getScopedObject(clazz);
if(result == null){
synchronized (Scopes.class){
result = source.getScopedObject(clazz);
if(result == null){
package org.cs500.homework3
import org.junit.Before;
import org.junit.Test;
import java.util.*;
import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertTrue;
@johncarl81
johncarl81 / gist:2012787
Created March 10, 2012 20:01
event handling
@EventName
public void callMe(String value1, String value2, Object anothervalue){
//value1 == "hello"
//value2 == "world"
//anotherValue = something else
}
or
@EventName
//static way (dont want to do this)
public class SlideshowActivity extends Activity{
public static void start(ArrayList<String> images, Song song, Uri videoUri, Context ctx){
Intent intent = new Intent(ctx, SlideshowActivity.class);
intent.putExtra(EXTRA_IMAGE_FILE_NAMES, images);
intent.putExtra(EXTRA_SELECTED_SONG, song);
intent.putExtra(EXTRA_VIDEO_URI, videoUri);
ctx.startActivity(intent);
}
@johncarl81
johncarl81 / gist:3923572
Last active October 11, 2015 21:38
Rotating Backups
#!/bin/bash
unset PATH;
# $1 = path to backup
# $2 = name of backup folder
# ------------- system commands used by this script --------------------
ID=/usr/bin/id;
ECHO=/bin/echo;
public class Parcels {
public static final String PARCELS_NAME = "Parcels";
public static final String PARCELS_REPOSITORY_NAME = "Transfuse$Parcels";
public static final String PARCELS_PACKAGE = "org.androidtransfuse";
private static final ParcelRepository PARCELS;
static{
ParcelRepository parcelsCreation;
public class Parcels {
public static final String PARCELS_NAME = "Parcels";
public static final String PARCELS_REPOSITORY_NAME = "Transfuse$Parcels";
public static final String PARCELS_PACKAGE = "org.androidtransfuse";
private static ParcelRepository PARCELS;
public static void initialise(ClassLoader classLoader){
loadParcels(classLoader);