Skip to content

Instantly share code, notes, and snippets.

View kevburnsjr's full-sized avatar

Kevin Burns kevburnsjr

View GitHub Profile
@kevburnsjr
kevburnsjr / keybase.md
Created June 29, 2019 23:49
keybase.md

Keybase proof

I hereby claim:

  • I am kevburnsjr on github.
  • I am kevburnsjr (https://keybase.io/kevburnsjr) on keybase.
  • I have a public key ASDX0fUOmV8JQl4Ni76Q7TDjw3Go7e3hKAA1DDrYRXgw1Ao

To claim this, I am signing this object:

@kevburnsjr
kevburnsjr / main.go
Created July 23, 2017 21:45
Easy Middleware in Go
package main
import (
"net/http"
"time"
"log"
)
func main() {
dh := DispatchHandler{}
import (
"./controller"
"net/http"
)
var routes = map[string]func(http.ResponseWriter, *http.Request){
"/": controller.Index,
"/acct": controller.Acct,
"/acct/auth": controller.AcctAuth,
// etc...
@kevburnsjr
kevburnsjr / Template.html
Created January 24, 2016 15:12
Microtemplating example
<!--
This is snippet is free to use without attribution, published under wtfpl-2.0
https://tldrlegal.com/license/do-wtf-you-want-to-public-license-v2-(wtfpl-2.0)
-->
<html>
<head>
<title>Microtemplate example</title>
</head>
<body>
<div id="target"></div>
sub vcl_fetch {
if (beresp.status >= 200 && beresp.status < 400
&& (req.request == "PUT" || req.request == "POST" || req.request == "DELETE")
&& beresp.http.x-inv) {
ban("obj.http.x-inv-by ~ " + beresp.http.x-inv);
}
}
sub vcl_deliver {
unset resp.http.x-inv-by;
unset resp.http.x-inv;
<?php
class Route {
public $name;
public $uri_templates = array();
public $params = array();
public function __construct($name, $uri_templates) {
$this->name = $name;
@kevburnsjr
kevburnsjr / lci.vcl
Created September 15, 2012 16:08
LCI in Varnish
# LCI
sub vcl_fetch {
# For successful unsafe responses
if (beresp.status >= 200 && beresp.status < 400
&& (req.request == "PUT" || req.request == "POST" || req.request == "DELETE")) {
# Purge all the resources marked for cascading purge
ban("req.http.host == " + req.http.host + " && obj.http.link ~ <" + req.url + ">;.rel=.inv-by.");
}
}
---
Part 1 - Introduction
Impetus
CCD
Rack/WSGI
Components
Connectors
Middleware
ROA
<link rel="canonical" type="text/html" href="http://cl.ly/2wr4" />
<link rel="alternate" type="image/png" href="http://cl.ly/2wr4/CloudApp_Logo.png" />
<link rel="alternate" type="application/json" href="http://my.cl.ly/items/1912559" />
<link rel="thumb" type="image/png" href="http://thumbs.cl.ly/2wr4" />
<?php
class Valid {
public static function password($pass) {
return strlen($pass) > 3;
}
public static function username($username) {
if(strlen($username) < 3 || strlen($username) > 30 ) {