Skip to content

Instantly share code, notes, and snippets.

@BenWard
BenWard / faves.php
Created August 17, 2009 20:54 — forked from blowery/faves.php
<?php
if (isset($_GET['errors'])) { error_reporting(E_ALL); } else { error_reporting(0); }
// Requires the Universal Feed Writer from http://www.phpclasses.org/browse/package/4427.html
include("FeedWriter.php");
define('FIREWALLED', true);
define('FIREWALL_ROOT', 'firewall/');
include(FIREWALL_ROOT.'config/db.php');
<!-- Microformats hCard Example. -->
<!-- By Ben Ward - http://benward.me http://twitter.com/benward -->
<!-- Re: http://twitter.com/joelevi/statuses/3897539999 -->
<!-- See hCard: http://microformats.org/wiki/hcard#type_subproperty_values -->
<!-- Initial, incorrect Example: -->
<span class="tel voice work pref">+1-866-461-7001</span>
<!--
@BenWard
BenWard / tidy-value-class-pattern.diff
Created October 11, 2009 03:35
A for HTMLTidy to prevent it dropping empty elements that have class attributes. Allows it to be used to pre-process HTML containing microformats without stripping out the value-class-pattern.
Index: attrs.h
===================================================================
RCS file: /cvsroot/tidy/tidy/src/attrs.h,v
retrieving revision 1.29
diff -r1.29 attrs.h
325a326
> #define attrGetCLASS( nod ) TY_(AttrGetById)( nod, TidyAttr_CLASS )
Index: parser.c
===================================================================
RCS file: /cvsroot/tidy/tidy/src/parser.c,v
<?php
$aOutput = array();
$aLines = explode("\n", file_get_contents($argv[1]));
$aKeys = explode("\t", array_shift($aLines));
foreach($aLines as $line) {
if (!trim($line)) {
@BenWard
BenWard / outlook-mac-access.css
Created January 13, 2010 19:47
A user CSS override to restyle Outlook Web Access 2003; to make it more Mac-like. Use this file with Fluid <http://fluidapp.com/>, or another Webkit renderer, to transform OWA into something more palatable. Micah Laaker has an icon you can use for the Flu
/**
# "Outlook Mac Access" CSS
A user CSS override to restyle Outlook Web Access 2003; to make it more Mac-like.
Use this file with Fluid <http://fluidapp.com/>, or another Webkit renderer, to transform
OWA into something more palatable.
By Ben Ward <http://benward.me>
## Status:
@BenWard
BenWard / microformats-locations.html
Created January 14, 2010 23:35
How to mark up a location using microformats (adr, geo and "named places" in hCard 1.01)
<!-- geo microformat: http://microformats.org/wiki/geo -->
<p class="geo">
<span class="latitude">1.30023</span>,
<span class="longitude">0.523323</span>
</p>
<!-- adr microformat: http://microformats.org/wiki/adr -->
<p class="adr">
<span class="street-address">701 First Avenue</span>,
<span class="locality">Sunnyvale</span>,
@BenWard
BenWard / µf-datetime.html
Created January 19, 2010 21:13
A set of examples for flexibly marking up dates and times in microformats (such as hCalendar and hAtom), using up-to-date patterns.
<!-- The different ways of marking up dates and times with microformats -->
<!-- Microformats are quite flexible when it comes to marking up dates in valid
HTML4. The value-class-pattern allows you to mark-up different parts of the
date, providing tool-tip context or nesting the data silently alongside a
custom format.
Date formatting in microformats no-longer requires using the `<abbr>`
element. -->
<!-- Core requirement for dates in microformats: The date must be available in an
/* Use this to cause a function to fire no more than once every 'ms' milliseconds.
For example, an expensive mousemove handler:
$('body').mouseover(ratelimit(function(ev) {
// ...
}, 250));
*/
function ratelimit(fn, ms) {
var last = (new Date()).getTime();
@BenWard
BenWard / gist:300776
Created February 10, 2010 19:57 — forked from mojodna/git-svn-diff.sh
A script to generate svn-style diffs from git repositories, compatible with Review Board
#!/bin/sh
#
# git-svn-diff
# Generate an SVN-compatible diff against the tip of the tracking branch
TRACKING_BRANCH=`git config --get svn-remote.svn.fetch | sed -e 's/.*:refs\/remotes\///'`
REV=`git svn find-rev $(git rev-list --date-order --max-count=1 $TRACKING_BRANCH)`
git diff --no-prefix $(git rev-list --date-order --max-count=1 $TRACKING_BRANCH) $* |
sed -e "s/^+++ .*/& (working copy)/" -e "s/^--- .*/& (revision $REV)/" \
-e "s/^diff --git [^[:space:]]*/Index:/" \
-e "s/^index.*/===================================================================/"
// Stupid simple bookmarklet function to duplicate the current page in a new window. Boom.
javascript:(function(){window.open(window.location.href)})();