Skip to content

Instantly share code, notes, and snippets.

@babcca
babcca / program.cs
Created Jan 6, 2018 — forked from wqweto/program.cs
Minimal .Net Web Server with Regex Routing in 177 LOC of C#
View program.cs
//
// 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 Feb 26, 2013
PHP mail sending
View gist:5042735
<?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))
View gist:2586549
min = Option("min", ..., new IntType(0));
max = Option("max", ..., new IntType(100));