Skip to content

Instantly share code, notes, and snippets.

View MoriTanosuke's full-sized avatar

Carsten MoriTanosuke

View GitHub Profile
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class HelloServlet extends HttpServlet {
@MoriTanosuke
MoriTanosuke / Car.java
Created October 7, 2010 13:28
Simple testcases to demonstrate JMockit Expectations
package de.kopis.example;
public class Car {
protected Engine engine;
public Car(Engine e) {
engine = e;
}
public void replaceEngine(Engine e) {
package de.kopis.katas;
public class CoverMeSimple {
public int simple(int x, int y) {
int z = x;
if(y > x)
z = y;
z *= 2;
package de.kopis.katas;
public class CoverMeSimple {
public int simple(int x, int y) {
int z = x;
if(y > x) {
z = y;
} else {
package de.kopis.katas;
public class FizzBuzz {
public String generate(int number) {
String result = null;
if(number == 0) {
result = "0";
} else if(number % 3 == 0 && number % 5 == 0) {
result = "FizzBuzz";
} else if(number % 3 == 0) {
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
public class Grep {
public static void main(String[] args) throws IOException {
if(args.length != 2) {
System.err.println("Wrong parameter count!");
System.err.println("USAGE:\tjava Grep pattern file");
package de.kopis.wave.robot;
import java.util.logging.Logger;
import com.google.wave.api.AbstractRobotServlet;
import com.google.wave.api.Blip;
import com.google.wave.api.Event;
import com.google.wave.api.RobotMessageBundle;
import com.google.wave.api.TextView;
import com.google.wave.api.Wavelet;
var huk;
function xchat_plugin_init()
{
huk = xchat_hook_server("PRIVMSG", XCHAT_PRI_NORM, "growlify", NULL);
}
function growlify(from, command, nickname, message)
{
var me = xchat_get_info("nick");
@MoriTanosuke
MoriTanosuke / hallowelt.clj
Created November 30, 2010 05:12
Einfaches Hallo Welt in Clojure
(println "Hallo, Welt!")