Skip to content

Instantly share code, notes, and snippets.

View alexlehm's full-sized avatar

Alexander Lehmann alexlehm

View GitHub Profile
@alexlehm
alexlehm / gist:8784013
Created February 3, 2014 13:43
calllogging
(function () {
var oldCall = Function.prototype.call;
var newCall = function(self) {
Function.prototype.call = oldCall;
console.log('Function called:', this.name);
var args=Array.prototype.slice.call(arguments,1);
Function.prototype.call = newCall;
this.apply(self, args);
}
Function.prototype.call = newCall;
vertx-platform/src/main/resources/default-repos.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/vertx-platform/src/main/resources/default-repos.txt b/vertx-platform/src/main/resources/default-repos.txt
index f2662ff..4fbef3b 100644
--- a/vertx-platform/src/main/resources/default-repos.txt
+++ b/vertx-platform/src/main/resources/default-repos.txt
@@ -5,7 +5,7 @@ mavenLocal:~/.m2/repository
maven:http://repo2.maven.org/maven2
@alexlehm
alexlehm / gist:9b8d3202552e223bc55e
Created November 9, 2014 10:42
fix location encoding
String fixStringEncoding(String s) {
byte[] bytes=new byte[s.length()];
for(int i=0;i<s.length();i++) {
bytes[i]=(byte) (s.charAt(i)&0xff);
}
try {
return new String(bytes,"utf-8");
} catch (UnsupportedEncodingException e) {
return "";
}
cReq.headers().set(req.headers());
change to:
MultiMap headers=req.headers();
headers.set("Connection", "close");
cReq.headers().set(headers);
@alexlehm
alexlehm / keybase.md
Created May 8, 2015 17:00
keybase.md

Keybase proof

I hereby claim:

  • I am alexlehm on github.
  • I am alexlehm (https://keybase.io/alexlehm) on keybase.
  • I have a public key whose fingerprint is A7F9 14EA 75D1 1E5E 3E1A 38F1 35C8 31A4 4747 B001

To claim this, I am signing this object:

mkdir temp.$$
cd temp.$$
split -b4k ../$1
md5sum -b x* >../$1.md5
rm x*
cd ..
rmdir temp.$$
@alexlehm
alexlehm / TimerCancelIssue.java
Created October 17, 2015 11:11
TimerCancelIssue.java
import java.util.concurrent.atomic.AtomicBoolean;
import org.junit.Test;
import org.junit.runner.RunWith;
import io.vertx.core.logging.Logger;
import io.vertx.core.logging.LoggerFactory;
import io.vertx.core.net.NetClient;
import io.vertx.ext.unit.Async;
import io.vertx.ext.unit.TestContext;
@alexlehm
alexlehm / TimerCancelTest.java
Created October 22, 2015 20:10
TimerCancelTest.java
import java.util.concurrent.atomic.AtomicBoolean;
import org.junit.Test;
import io.vertx.core.Vertx;
import io.vertx.core.eventbus.impl.HandlerRegistration;
import io.vertx.test.core.VertxTestBase;
/**
* @author <a href="http://oss.lehmann.cx/">Alexander Lehmann</a>
import java.util.concurrent.atomic.AtomicInteger;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import io.vertx.core.Vertx;
import io.vertx.core.http.HttpClient;
import io.vertx.core.http.HttpClientOptions;
//This module is adapted from the CodeIgniter framework
//The license is available at http://codeigniter.com/
var html_entity_decode = require('./entities').decode;
var never_allowed_str = {
'document.cookie': '[removed]',
'document.write': '[removed]',
'.parentNode': '[removed]',