Skip to content

Instantly share code, notes, and snippets.

@babcca
babcca / program.cs
Created January 6, 2018 01:43 — forked from wqweto/program.cs
Minimal .Net Web Server with Regex Routing in 177 LOC of C#
//
// Poor Man's Web Server with Regex Routing in 177 LOC of C#
//
// This is a simple standalone http server that handles routing with regular expressions
// matching. For each request the router passes capture groups to handlers as a data dictionary.
//
// Router implementation constructs a single composite regex to match request path, based on
// https://nikic.github.io/2014/02/18/Fast-request-routing-using-regular-expressions.html
//
// One can use `WebServer` and `Router` classes alone, just has to register all custom
@babcca
babcca / gist:5042735
Created February 26, 2013 22:09
PHP mail sending
<?php
$name = $_POST["name"];
$surname = $_POST["surname"];
$phone = $_POST["phone"];
$to = "who@where.com";
$subject = "Predmet mailu";
$message = "Uzivatel $name $surname zada o kontakt na telefonu $phone";
if (!mail($to, $subject, $message))
min = Option("min", ..., new IntType(0));
max = Option("max", ..., new IntType(100));