Skip to content

Instantly share code, notes, and snippets.

class Article {
Long id;
String title;
String content;
User author;
}
class User {
Long id;
DB.update("user", {hash: passwordHash, salt: passwordSalt}, {id: userId});

Keybase proof

I hereby claim:

  • I am martijnvogten on github.
  • I am martijnvogten (https://keybase.io/martijnvogten) on keybase.
  • I have a public key ASDeu7j8p6PhGdRHVsf75SUxDl9HRf_7acikT8m8QCbC3wo

To claim this, I am signing this object:

@martijnvogten
martijnvogten / LoggingOutputStream.java
Last active October 30, 2023 04:34
Redirect System.out and System.err to an slf4j Logger
import java.io.ByteArrayOutputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import org.slf4j.Logger;
public class LoggingOutputStream extends OutputStream {
public static void redirectSysOutAndSysErr(Logger logger) {
System.setOut(new PrintStream(new LoggingOutputStream(logger, LogLevel.INFO)));
@martijnvogten
martijnvogten / binaryload.js
Created March 21, 2012 11:33
load binary file
jvm.fetchBytes = function(url) {
var req = new XMLHttpRequest();
req.open('GET', url, false);
// XHR binary charset opt by Marcus Granado 2006 [http://mgran.blogspot.com]
req.overrideMimeType('text/plain; charset=x-user-defined');
req.send(null);
if (req.status != 200) {
throw "Could not load file";
@martijnvogten
martijnvogten / binaryload_ie.js
Created March 21, 2012 11:24
load binary file in IE
if(/msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent)) {
var IEBinaryToArray_ByteStr_Script =
"<!-- IEBinaryToArray_ByteStr -->\r\n"+
"<script type='text/vbscript'>\r\n"+
"Function IEBinaryToArray_ByteStr(Binary)\r\n"+
" IEBinaryToArray_ByteStr = CStr(Binary)\r\n"+
"End Function\r\n"+
"Function IEBinaryToArray_ByteStr_Last(Binary)\r\n"+
" Dim lastIndex\r\n"+
" lastIndex = LenB(Binary)\r\n"+