Skip to content

Instantly share code, notes, and snippets.

View koert's full-sized avatar

Koert Zeilstra koert

View GitHub Profile
@koert
koert / minimal-beans.xml
Created July 5, 2015 07:57
Minimal beans.xml
<beans xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
</beans>
@koert
koert / minimal-web.xml
Created July 5, 2015 07:56
Minimal web.xml for servlet 3.0
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<display-name>test-service</display-name>
</web-app>
@koert
koert / HelloRepository.java
Created July 5, 2015 07:55
Example repository that produces a greeting
/**
* Example repository.
* @author Koert Zeilstra
*/
public class HelloRepository {
/**
* @return Example greeting.
*/
public String getGreeting(String name) {
return "Hello world " + name;
@koert
koert / TestService.java
Created July 5, 2015 07:52
Example REST service implemented with JAX RS
import javax.annotation.ManagedBean;
import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.xml.bind.annotation.XmlRootElement;
/**
* JAX RS implementation of REST logfile service.
@koert
koert / HtmlToText.java
Last active March 26, 2020 16:10
Extract plain text from HTML
import javax.swing.text.MutableAttributeSet;
import javax.swing.text.html.HTML;
import javax.swing.text.html.HTMLEditorKit;
import javax.swing.text.html.parser.ParserDelegator;
final StringBuilder sb = new StringBuilder();
HTMLEditorKit.ParserCallback parserCallback = new HTMLEditorKit.ParserCallback() {
public boolean readyForNewline;
@koert
koert / absolute-position.html
Created September 6, 2012 13:07
Absolute/relative positioning
<p:outputPanel layout="block" style="position: relative;">
<div style="position: absolute; top: 0.5em; right: 0.5em; z-index: 10;">
</div>
</p:outputPanel>