Skip to content

Instantly share code, notes, and snippets.

View britter's full-sized avatar

Benedikt Ritter britter

View GitHub Profile

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
@britter
britter / sample.plugin.js
Created November 20, 2014 08:37
Sample jQuery Plugin
(function($) {
var settings = {
settingA = "value1",
settingsB = "value2"
}
$.fn.myplugin = function(options) {
$.extend(settings, options);
return this.each(function(index, item) {
@britter
britter / AModel.java
Created February 20, 2015 14:40
Testing static methods
public class AModel extends Model {
public static AModel createAModel() {
return new AModel().doCreateAModel();
}
// package private for testing
AModel doCreateAModel() {
// code which was previously in createAModel()
}
@britter
britter / ToArrayBenchmark.java
Created May 7, 2015 20:21
ArrayList.toArray Benchmark
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@britter
britter / ToArrayBenchmark.java
Created May 7, 2015 20:34
Comparison of array creation via reflection and via constructor
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Apache Commons Imaging 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.6.1:clean (default-clean) @ commons-imaging ---
[INFO] Deleting /Users/bene/workspace/apache/commons/imaging/target
[INFO]
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (enforce-maven-3) @ commons-imaging ---
@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