Skip to content

Instantly share code, notes, and snippets.

" ------------
" Vim settings
" ------------
" Always use long form options, so it's more obvious what they do
set nocompatible " Use Vim defaults (better than Vi defaults)
filetype plugin indent on
set encoding=utf8 " Set encoding
scriptencoding utf-8
@davidnash
davidnash / class-custom-breadcrumb.php
Last active October 2, 2017 21:25
Better breadcrumbs for WC_Breadcrumb 2.3.0
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* WC_Breadcrumb class.
*
* @class WC_Breadcrumb
@davidnash
davidnash / index.php
Created May 12, 2016 09:43
Pretty print fractions as HTML characters using PHP
//from post at http://davidnash.com.au/pretty-print-fractions-html-characters-using-php/
//supply a string, eg 1/2, return eg ½
function str_to_fraction( $str ) {
$f = explode('/', $str);
if( count($f) != 2 ) {
return $str; //if there's multiply / chars, this isn't a fraction
}
else {