Skip to content

Instantly share code, notes, and snippets.

View carchrae's full-sized avatar
🌄
again

Tom Carchrae carchrae

🌄
again
View GitHub Profile
@carchrae
carchrae / README.md
Created July 31, 2015 01:21
World head

README is empty

//no vars on this stuff - lets me customize the window/document objects
document = jsdom();
window = document.createWindow();
window.hasBigEars = true;
//this is/was client side js that expects certain window properties to be there - eg, hasBigEars
var app = require('./js-that-loves-big-ears.js');
public static native void log(String text) /*-{
if ($wnd.console && $wnd.console.log) {
$wnd.console.log(text);
}
}-*/;
package java.text;
import com.google.gwt.i18n.client.NumberFormat;
public class DecimalFormat {
private NumberFormat nf;
public DecimalFormat(String pattern) {
this.nf = NumberFormat.getFormat(pattern);
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/Vertx-Server"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"/>
<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;sourceLookupDirector&gt;&#10;&lt;sourceContainers duplicates=&quot;true&quot;&gt;&#10;&lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#10;&amp;lt;javaProject name=&amp;quot;GLWT&amp;quot;/&amp;gt;&amp;#10;&quot; typeId=&quot;org.eclipse.jdt.launc
ClientGetter playClientGetter = new ClientGetter() {
private int playPort;
private String playHost;
{
String portString = System.getenv("PLAY_PORT");
if (portString == null)
portString = "9000";
playPort = Integer.parseInt(portString);
playHost = System.getenv("PLAY_HOST");
@carchrae
carchrae / Log.java
Created October 24, 2013 18:11
snippit of code for grabbing the stack/filename/lines in GWT
public class Log {
/*
* type - is "INFO", "DEBUG", "ERROR" etc
* object - is an "id" of the person calling it. as a convention, I use 'this' unless it is a static method, then I pass in the class
* msg - the log message
*/
public static void log(String type, Object object, String msg) {
@carchrae
carchrae / build.xml
Created October 24, 2013 16:04
An ant build that includes source in a jar
<?xml version="1.0" encoding="utf-8" ?>
<project name="glwt" default="jar" basedir=".">
<property name="gwt.sdk" location="/home/tom/bin/gwt" />
<property name="dust.version" location="1.2.6" />
<property name="dust.path" location="/home/tom/code/javascript/dustjs" />
<property name="dust.path.src" location="${dust.path}/dist" />
<property name="dust.path.dst" location="src/glwt/dust/client/js" />
@carchrae
carchrae / Promise.java
Created October 2, 2013 14:19
My take on a java promise interface
public interface Promise<T> {
Promise<T> resolve(T value);
Promise<T> resolve(Promise<T> promise);
Promise<Throwable> reject(Throwable e);
Promise<T> then(CallbackFunction onResolved);
Handler<Throwable> onError = new Handler<Throwable>(Throwable.class) {
@Override
public Throwable handle(Throwable value) {
value.printStackTrace();
return value;
}
};