Instantly share code, notes, and snippets.

View Client.cs
// Asynchronous Client Socket Example
using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.Text;
// State object for receiving data from remote device.

Using the line define('NOBLOGREDIRECT', '%siteurl%'); in your wp-config.php makes it so that when someone enters a subdomain that does not exist on your site, it will redirect to whatever url you specify. You can use this to have it either go to a specific FAQ page or directly back to the main root installation, anywhere you want to direct it. the variable %siteurl% can be replaced; for example define('NOBLOGREDIRECT', '');

When someone in their browser tries to go to a subdomain that doesn't exist (for example,, they will be redirected to what is defined for NOBLOGREDIRECT.

Without using NOBLOGREDIRECT the (for example) – which is a subdomain that doesn't exist would direct to the signup page asking which reports whether or not the user can create the bad subdomain in question. This is fine, there's nothing wrong with it redirecting to the signup page if someone put in a bad url. However, those of


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 ""