Skip to content

Instantly share code, notes, and snippets.

Matthias Adler macedigital

Block or report user

Report or block macedigital

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@macedigital
macedigital / index.js
Created Apr 26, 2018
Handle runtime exception with express-js
View index.js
const express = require('express');
const app = express();
const http = require('http');
const server = http.createServer(app);
const xmlparser = require('express-xml-bodyparser');
app.use(xmlparser());
app.post('/xml', (req, res, next) => {
console.log(req.body); // handle parsed xml
@macedigital
macedigital / express-xml-bodyparser.js
Created Jan 16, 2017
Alternative for parsing incoming XML in express apps, instead of using https://github.com/macedigital/express-xml-bodyparser.
View express-xml-bodyparser.js
var express = require('express'),
typeis = require('type-is');
var app = express();
var xmlParseOptions = {
async: false, // Setting to `true` causes issues with exceptions
explicitArray: false,
trim: true,
normalize: true,
View nginx-libressl-static.sh
#!/usr/bin/env bash
# Names of latest versions of each package
export VERSION_PCRE=pcre-8.39
export VERSION_ZLIB=zlib-1.2.8
export VERSION_LIBRESSL=libressl-2.4.2
export VERSION_NGINX=nginx-1.11.3
# URLs to the source directories
export SOURCE_LIBRESSL=http://ftp.openbsd.org/pub/OpenBSD/LibreSSL/
@macedigital
macedigital / express-xml-bodyparser-sample.js
Created Sep 18, 2015
Minimal example for using express-body-parser middleware
View express-xml-bodyparser-sample.js
var express = require('express');
var app = express();
var http = require('http');
var server = http.createServer(app);
var xmlparser = require('express-xml-bodyparser');
// fyi: it'd be better to attach the parser to wanted routes only
app.use(xmlparser());
app.post('/xml', function(req, res, next) {
@macedigital
macedigital / gist:ea540099097f7ec4c2f5
Last active Aug 29, 2015
Solarium 3.x Solr 5.1.x Curl Adapter GET method fix
View gist:ea540099097f7ec4c2f5
--- symfony/vendor/solarium/solarium/library/Solarium/Core/Client/Adapter/Curl.php (revision )
+++ symfony/vendor/solarium/solarium/library/Solarium/Core/Client/Adapter/Curl.php (revision )
@@ -155,10 +155,6 @@
curl_setopt($handler, CURLOPT_PROXY, $proxy);
}
- if (!isset($options['headers']['Content-Type'])) {
- $options['headers']['Content-Type'] = 'text/xml; charset=utf-8';
- }
-
@macedigital
macedigital / rss.jade
Created Apr 1, 2014
Using jade template to render rss-feed in nodejs
View rss.jade
doctype xml
rss(version='2.0')
channel
title= feed.title
description= feed.description
link= feed.link
language= feed.en
for item in posts
item
title= item.title
You can’t perform that action at this time.