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 / 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;
}
};
@carchrae
carchrae / main.js
Last active December 22, 2015 11:08
javascript verticle for template rendering with dust.js
var vertx = require("vertx.js")
var console = require('vertx/console');
console.log('module ' + JSON.stringify(module));
var dust;
var x = function(){
var module = undefined;
@carchrae
carchrae / gist:5976820
Last active December 19, 2015 15:29
weird behaviour with gwt java editor
package bug;
import com.google.gwt.core.client.GWT;
public class FormatBug {
public boolean testVar;
public static void testMethodString(String s) {
GWT.log(s);
@carchrae
carchrae / gist:5885201
Created June 28, 2013 14:42
ace to support versions of file
var editor = ace.edit("editor-container");
editor.setTheme("ace/theme/monokai");
if (!glwt.ace){
glwt.ace = { sessions : {} };
}
var oldSession = glwt.ace.sessions["{template.name}"];
var src = "{template.source|s|j}";
if (oldSession){
editor.setSession(oldSession);
package glwt.dust.rebind;
import java.io.PrintWriter;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
import com.google.gwt.core.ext.CachedGeneratorResult;
@carchrae
carchrae / dust-context.js
Created June 20, 2013 18:01
add this javascript after you load dust.js and it will allow you to reference dot path contexts in nested scopes and globals. see https://github.com/linkedin/dustjs/pull/271 for more details
//supports dot path resolution, function eval, and searching global paths
Context.prototype.getPath = function(cur, down) {
var ctx = this.stack,
len = down.length,
tail = cur ? undefined : this.stack.tail;
if (cur && len === 0) return ctx.head;
ctx = ctx.head;
var i = 0;
03:09:02 PM - atomatom: is it possible to: a) watch a directory of files to determine if a generator should be re-run (eg, say a generator that includes all files in a directory) or b) force it to re-generate the Impl code each time?
03:10:34 PM - icfantv has left the room (Quit: Leaving.).
03:11:28 PM - stefan_ [~stefan@89.204.155.184] entered the room.
03:13:25 PM - Twiner [~Twiner@c-75-68-119-219.hsd1.nh.comcast.net] entered the room.
03:20:37 PM - xjrn: if intellij is any lesson, the file-watcher is platform specific
03:21:19 PM - xjrn: but then roo seems to do what you're saying without an exe
03:21:29 PM - xjrn: with glitches
03:27:44 PM - atomatom: thanks xjrn - yeah, i'm thinking being too automatic is going to get frustrating
03:29:36 PM - xjrn: once roo derails, it stays down
03:31:10 PM - atomatom: btw, i'm not using roo/intellij, just eclipse + gwt's incremental compilation
import org.springframework.security.authentication.encoding.Md5PasswordEncoder;
public class CustomMd5PasswordEncoder extends Md5PasswordEncoder {
@Override
protected String mergePasswordAndSalt(String password, Object salt,
boolean strict) {
if (password == null) {
password = "";
}