Skip to content

Instantly share code, notes, and snippets.

@barnabywalters
barnabywalters / h-event.html
Created May 4, 2014 14:10
php-mf2 dt-* <data class="value"> parse demonstration
<div class="h-event">
<span class="dt-start">
<data class="value" value="2013-01-01">first day of 2013</data> at
<data class="value" value="21:00">nine in the evening</data>
</div>
@barnabywalters
barnabywalters / authorization.php
Last active August 29, 2015 14:01
indieauth client/server setup code
<?php
// Create a micropub client app — allows users to log in and authorize this app to make requests on their behalf to,
// e.g. a micropub endpoint, authenticates requests based on remember-me cookie.
// $dataToCookie and $dataFromCookie map between the array of information about the current user and the string value
// stored in the remember-me cookie
//
// Adds routes:
// /login
// /authorize
@barnabywalters
barnabywalters / note.yaml
Created June 8, 2014 22:33
Example YAML of one of my notes
id: 4DtGgd
author:
type: h-card
url: 'http://waterpigs.co.uk'
photo: 'http://photos.waterpigs.co.uk/photos/custom/201210/5d5a4d-Facing-Down_100x100xCR.jpg'
name: 'Barnaby Walters'
name: 'Just added some more tunes to http://www.waterpigs.co.uk/wpsm/ — As far as I can tell, it''s the largest collection of hurdy gurdy sheet music on the web! #folkmusic #hurdygurdy #abc'
content: "<p>Just added some more tunes to <a class=\"auto-link\" href=\"http://www.waterpigs.co.uk/wpsm/\">http://www.waterpigs.co.uk/wpsm/</a> — As far as I can tell, it's the largest collection of hurdy gurdy sheet music on the web! <a rel=\"tag\" href=\"/tags/folkmusic\">#folkmusic</a> <a rel=\"tag\" href=\"/tags/hurdygurdy\">#hurdygurdy</a> <a rel=\"tag\" href=\"/tags/abc\">#abc</a></p>\n"
published: '2011-09-16T16:41:38+00:00'
updated: null
<xml id="skufilterbrowse" class="slide">
<productcatalog><labels><label key="skuset.deliverypolicyurl">Delivery policy content URL</label><label key="price.save">Save</label><label key="skuset.seemoredetails">See more details</label><label key="price.additionaloffers">Additional Offers</label><label key="price.freeitem">Includes Free Item*</label><label key="price.instsaving">Instant Savings</label><label key="skuset.eddieseedetails">See details </label><label key="price.rebateurl">RebateURL</label><label key="skuset.freedelivery">FREE SHIPPING, plus 5% back for Rewards Members</label><label key="price.printableCoupons">Click here for Printable Coupon</label><label key="price.value">Value</label><label key="skuset.eddieshipdetails">Estimated to arrive no later than </label><label key="price.qty">Qty.</label><label key="price.chooseyouritems">Choose your Items</label><label key="price.true">true</label><label key="skuset.clearancemessage">&lt;strong&gt;CLEARANCE ITEM:&lt;/strong&gt; </label><label key="price
@barnabywalters
barnabywalters / style.css
Created September 5, 2012 19:22
em based responsive line lengths with cascading breakpoints and stuff
/*
* The basic idea:
* No more "mobile first", just take up the entire browser width when
* optimum line length gets near viewport width.
*/
body
{
width: 100%;
}
<?php
$render = function ($_path, $data) {
extract($data);
unset($data);
require $_path;
};
ob_start();
$render($_path, $data);
<?php
namespace BarnabyWalters\Rest;
use Symfony\Component\Routing\Matcher\UrlMatcher as Matcher;
/**
* UrlMatcher
*
* A subclass of Symfony’s UrlMatcher which strips the extension from incoming
{
"alternates": [
{
"url": "http://example.org",
"rel": "home",
"media": "screen",
"hreflang": "en"
}
],
"rels":
@barnabywalters
barnabywalters / input.html
Last active December 17, 2015 21:18
Test case for microformats-2 e-* p-* HTML injection potential security hole
<span class="h-thing">
<span class="e-content">&lt; Things &gt; &amp;</span>
</span>
<span class="h-thing">
<span class="p-content">&lt; Things &gt; &amp;</span>
</span>
@barnabywalters
barnabywalters / notes.web
Last active December 20, 2015 20:09
Rough ideas for a gherkin-like environment for writing web applications. Things in parentheses are comments. `do some name` triggers the 'some name' signal defined by `on some name`
on GET /notes
fetch the 20 most recent notes filtered by tag
show as h-feed
on GET /notes/new
the user must be an admin
show autofilled note-form
on GET /notes/{id}
fetch note