Instantly share code, notes, and snippets.


work in progress

using bootstrap 4, importing fontawesome but not using it yet


Customizing The Grapevine 4 Logger

First, create a class that implements the IGrapevineLogger interface.

public class MyCustomLogger : IGrapevineLogger
    // implementation details
View grapevine-input-validation.cs
// the context will be passed into the method automatically by the router
server.Router.BeforeRouting += context =>
// Do your input validation here
if (!context.Request.Payload.Contains("elephant"))
// by sending a response to the request, no additional processing will occur.
context.Response.SendResponse(HttpStatusCode.BadRequest, "no elephants allowed");

Create the class that manages the list of APIs as a singleton.

public class ApiKeyManager
    private static ApiKeyManager _instance;
    public readonly List<string> ApiKeys = new List<string>();

    private ApiKeyManager() {}

To set up a route that parses parameters from the path info:

[RestRoute(HttpMethod = HttpMethod.GET, PathInfo = "/cars/[carId]")]
public IHttpContext GetCarById(IHttpContext context)
	// Get the car id from the incoming context:
View .gitconfig
name = Your Name
email =
cm = commit -m
co = checkout
find = log --pretty=\"format:%Cgreen%H %Cblue%s\" --name-status --grep
lola = log --graph --decorate --pretty=oneline --abbrev-commit
nix = clean -dfx
personal = config ""
View open-cover-xunit.bat
REM OpenCover-xunit.bat
REM Run opencover against xunit tests in your test project and show report of code coverage
Set SearchDirectory=%~dp0Grapevine.Tests\bin\Debug
SET DllContainingTests=%~dp0Grapevine.Tests\bin\Debug\Grapevine.Tests.dll
REM *** IMPORTANT - Change DllContainingTests variable (above) to point to the DLL
View .gitconfig
personal = config ""

XML Element Ordering


If your XSD is using the xs:sequence indicator, then the order of the elements in that complex type matters, and they should be included in the order listed inside the tag.

XML Specification

Generally speaking, the order in which child elements appear inside their parent element container in XML shouldn't matter. As such, the following two examples would be considered semantically equivalent XML.


Using NTLM in Node.js

Add a project dependency for express-ntlm. In your express configuration, require in this package.

var app = require('express');
var ntlm = require('express-ntlm');

Just before adding routes to the app (after all the body parsing and static references, etc.):