Skip to content

Instantly share code, notes, and snippets.

View britter's full-sized avatar

Benedikt Ritter britter

View GitHub Profile
@britter
britter / StaticMenu.java
Last active December 16, 2015 10:49
Example for creating a static sub menu in an Eclipse RCP application
MenuManager parent = new MenuManager("Root menu");
MenuManager sub = new MenuManager("Sub menu");
IAction one = new Action(){};
one.setText("one");
IAction two = new Action(){};
two.setText("two");
IAction one = new Action(){};
three.setText("three");
@britter
britter / DynamicMenuTest.java
Last active December 16, 2015 10:49
"Pure JUnit test" for a custom JFaces MenuManager
public class DynamicMenuTest {
private MenuManager menu;
@Before
public void setUp() {
menu = new DynamicMenu();
}
@Test
@britter
britter / CSVCustomerReader.java
Created May 20, 2013 19:23
Definition of a reader interface and a corresponding implementation that reads Customer objects from CSVRecords
public class CSVCustomerReader implements Reader<CSVRecord, Customer> {
public Customer read(CSVRecord source) {
// TODO implement me :)
return null;
}
}
@Test
public void testExecuteDispatchLookup_2() {
// use default catalog
catalog.addCommand("barCommand", new TestCommand<Context<String, Object>>("2"));
// command should lookup the fooCommand and execute the fooMethod
command.setName("fooCommand");
command.setMethod("fooMethod");
@britter
britter / CollectionUtils.java
Last active December 23, 2015 09:29
Example of how an adapter collection could work in commons collections
/*
* Creates an adapter collection of the given collection. The returned collection is an unmodifiable
* view of {@code col}. Adapters will be created on the fly. In other words, when an element from col
* is requested, it is passed to {@code transformer} and the result is returned. The created adapters
* are not cached. If an element is requested twice, a new adapter will be created for each call.
*
* @param col the collection to create the adapter collection for
* @param transformer the tranformer that creates adapters from the elements of col
* @param E the type of the elements in col
* @param A the type of the adapters
@britter
britter / .bash_profile
Created December 14, 2013 15:13
My .bash_profile used on my MacBooko Pro: Includes development tools in PATH. Prepends /usr/local/bin and /usr/local/sbin to PATH, since on Mac OS the default PATH has /usr/bin before /usr/local/bin (for what ever reason). Sets up the prompt and bash completion. Configures man pages to be shown in PDF Viewer.
## SDKs ##
export JAVA_6_HOME=`/usr/libexec/java_home -v 1.6`
export JAVA_7_HOME=`/usr/libexec/java_home -v 1.7`
export JAVA_8_HOME=`/usr/libexec/java_home -v 1.8`
export JAVA_HOME=$JAVA_7_HOME
export GROOVY_HOME=/Applications/dev/groovy/groovy-2.1.5
export SCALA_HOME=/Applications/dev/scala/scala-2.10.2
## Build Tools ##
export MAVEN_HOME=/Applications/dev/maven/apache-maven-3.1.1
@britter
britter / jdk7-timezones.txt
Last active January 2, 2016 03:09
TimeZones present in JDK7 and JDK8, sorted alphabetically by their key, as well as a diff.
sun.util.calendar.ZoneInfo[id="ACT",offset=34200000,dstSavings=0,useDaylight=false,transitions=10,lastRule=null]
sun.util.calendar.ZoneInfo[id="AET",offset=36000000,dstSavings=3600000,useDaylight=true,transitions=142,lastRule=java.util.SimpleTimeZone[id=AET,offset=36000000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=9,startDay=1,startDayOfWeek=1,startTime=7200000,startTimeMode=1,endMode=3,endMonth=3,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=1]]
sun.util.calendar.ZoneInfo[id="AGT",offset=-10800000,dstSavings=0,useDaylight=false,transitions=62,lastRule=null]
sun.util.calendar.ZoneInfo[id="ART",offset=7200000,dstSavings=0,useDaylight=false,transitions=125,lastRule=null]
sun.util.calendar.ZoneInfo[id="AST",offset=-32400000,dstSavings=3600000,useDaylight=true,transitions=142,lastRule=java.util.SimpleTimeZone[id=AST,offset=-32400000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,end

Keybase proof

I hereby claim:

  • I am britter on github.
  • I am britter (https://keybase.io/britter) on keybase.
  • I have a public key whose fingerprint is CD54 6431 5F0B 98C7 7E6E 8ECD 9DAA DC1C 9FCC 82D0

To claim this, I am signing this object:

function Person(first,last,age) {
this.firstname = first;
this.lastname = last;
this.age = age;
var bankBalance = 7500;
var returnBalance = function() {
return bankBalance;
};
@britter
britter / docker-artifactory.log
Created July 18, 2014 08:08
Failed artifactory docker start
bene@Benedikts-MacBook-Pro:~/workspace/apache/commons/lang$ boot2docker up
2014/07/18 10:04:09 Waiting for VM to be started...
2014/07/18 10:04:20 Started.
2014/07/18 10:04:20 To connect the Docker client to the Docker daemon, please set:
2014/07/18 10:04:20 export DOCKER_HOST=tcp://192.168.59.103:2375
bene@Benedikts-MacBook-Pro:~/workspace/apache/commons/lang$ redock
bene@Benedikts-MacBook-Pro:~/workspace/apache/commons/lang$ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
ubuntu latest e54ca5efa2e9 4 weeks ago 276.5 MB