Skip to content

Instantly share code, notes, and snippets.

View evantbyrne's full-sized avatar

Evan Byrne evantbyrne

View GitHub Profile
@joshlf
joshlf / doer.go
Created October 2, 2016 17:05
A demonstration of a self-cleaning worker
// This is an example of a self-cleaning worker. A common pattern in Go
// is to have a type which, when created with NewX, spawns one or more
// goroutines in the background to perform work. It is usually the
// caller's responsibility to call Close() or Stop() in order to shut
// these workers down and not leak goroutines and the memory resources
// that the goroutines have references to.
//
// The idea behind a self-cleaning worker is to leverage the runtime's
// ability to set finalizers on objects in order to detect when an object
// with a still-live worker goroutine has gone out of scope. The type
@lluchs
lluchs / html5.php
Created August 9, 2012 12:10
HTML Purifier definition for some HTML5 tags
<?php
// http://developers.whatwg.org/sections.html
$def->addElement('section', 'Block', 'Flow', 'Common');
$def->addElement('nav', 'Block', 'Flow', 'Common');
$def->addElement('article', 'Block', 'Flow', 'Common');
$def->addElement('aside', 'Block', 'Flow', 'Common');
$def->addElement('header', 'Block', 'Flow', 'Common');
$def->addElement('footer', 'Block', 'Flow', 'Common');