Skip to content

Instantly share code, notes, and snippets.

View kredmer's full-sized avatar

Karsten Redmer kredmer

  • Saleshype UG(haftungsbeschränkt)
  • Hamburg, Germany
View GitHub Profile
@kredmer
kredmer / echoHttpRequest.js
Last active August 29, 2015 14:11 — forked from Marak/echoHttpRequest.js
Echo HTTP requests
module['exports'] = function echoHttp (hook) {
hook.debug("Debug messages are sent to the debug console");
hook.debug(hook.params);
hook.debug(hook.req.path);
hook.debug(hook.req.method);
@kredmer
kredmer / e4x2json.js
Last active December 16, 2015 22:19 — forked from olegp/e4x2json.js
// One way converter from E4X XML to JSON
// 1) turns <body><item>1</item><item>2</item></body> into
// body: {item: ["1", "2"]} so that lists are easier to work with
// 2) turns things like: <body a="a">whatever</body> into
// body: {_a: "a", _: "whatever"}
// however <body>whatever</body> becomes simply body: "whatever
// - attributes specified by ignored are ignored
function E4XtoJSON(xml, ignored) {
var r, children = xml.*, attributes = xml.@*, length = children.length();
if(length == 0) {