Skip to content

Instantly share code, notes, and snippets.

@TomTasche
TomTasche / ifconfigme.java
Created September 15, 2011 20:40
Quick n dirty ifconfig.me call in Java
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpGet httpGet = new HttpGet("http://ifconfig.me/ip");
HttpResponse httpResponse = httpClient.execute(httpGet);
System.out.println(new BufferedReader(new InputStreamReader(httpResponse.getEntity().getContent())).readLine());
@TomTasche
TomTasche / SuperfeedrServlet.java
Created September 12, 2011 20:57
SuperfeedrServlet for accessing private (aka authenticated) feeds
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletException;
@TomTasche
TomTasche / bloki_styles.html
Created August 19, 2011 12:25
Available Bloki styles
<!-- See them all at http://bloki-engine.appspot.com/gallery/designs.html -->
<link href="http://bloki-engine.appspot.com/style/button/plain.css"
rel="stylesheet" type="text/css" />
<link href="http://bloki-engine.appspot.com/style/getsatisfaction/horizontal_black.css"
rel="stylesheet" type="text/css" />
<link href="http://bloki-engine.appspot.com/style/getsatisfaction/horizontal_blue.css"
rel="stylesheet" type="text/css" />
@TomTasche
TomTasche / gwt_dialogbox.html
Created August 18, 2011 09:19
GWT DialogBox
<div style="position: absolute; overflow-x: visible; overflow-y: visible; left: 346px; top: 0px; visibility: visible; " class="gwt-DialogBox"><div class="" title="Bloki - Crowdsourced typo fixjng"><table cellspacing="0" cellpadding="0" class=""><tbody><tr class="dialogTop"><td class="dialogTopLeft"><div class="dialogTopLeftInner"></div></td><td class="dialogTopCenter"><div class="dialogTopCenterInner"><div class="Caption">Bloki - Crowdsourced typo fixjng</div></div></td><td class="dialogTopRight"><div class="dialogTopRightInner"></div></td></tr><tr class="dialogMiddle"><td class="dialogMiddleLeft"><div class="dialogMiddleLeftInner"></div></td><td class="dialogMiddleCenter"><div class="dialogMiddleCenterInner dialogContent"><div class="gwt-HTML"><p>You probably ask yourself what this strange is. Well, it's Bloki.<br>Bloki helps a blog or website's owner to fix typos and missspellings. How? Using <b>your</b> help:<br>If you come across a typo or missspelling simply select the word / sentence and submit a correc
@TomTasche
TomTasche / multicatch.java
Created August 11, 2011 11:37
Multi-catches in Java 7
try {
// do something
} catch (IllegalArgumentException | ArithmeticException | NullPointerException e) {
// catch something
}
@TomTasche
TomTasche / autoclose_objects.java
Created August 11, 2011 11:35
Auto-closing objects in Java 7
try (InputStreamReader reader = new InputStreamReader(null);
BufferedReader buffReader = new BufferedReader(null)) {
// do something
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
@TomTasche
TomTasche / switch_string.java
Created August 11, 2011 10:26
Use strings in a switch
String name = "abc";
switch (name) {
case "Anton":
System.out.println("a");
break;
case "Berta":
System.out.println("b");
}
@TomTasche
TomTasche / positioing_css.css
Created August 11, 2011 10:18
Positioning in CSS
.yetanotherdiv {
position: fixed;
right: 10px;
bottom: 0;
}
@TomTasche
TomTasche / append_text.css
Created August 11, 2011 10:17
Adding text using CSS
.yetanotherdiv:before {
content: "tomtasche.at";
}
@TomTasche
TomTasche / GWT_body_2.java
Created August 8, 2011 10:21
Yet another method to access a page's body in GWT
Document.get().getBody();