Skip to content

Instantly share code, notes, and snippets.

View surdaft's full-sized avatar
🤓

SurDaft - Jack Stupple surdaft

🤓
View GitHub Profile
@surdaft
surdaft / links.txt
Created May 11, 2017 09:50
Calculate aspect ratio percentage.
@surdaft
surdaft / no_select.css
Created April 12, 2017 16:17
CSS to disable text highlighting
/**
* http://stackoverflow.com/questions/826782/how-to-disable-text-selection-highlighting-using-css
*/
.noselect {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
@surdaft
surdaft / dimonx_breadcrumbs.php
Last active April 12, 2017 12:52
Wordpress breadcrumbs
<?php
// Copied from https://github.com/benbuildsstuff/base
function dimox_breadcrumbs() {
$showOnHome = 0; // 1 - show breadcrumbs on the homepage, 0 - don't show
$delimiter = '/'; // delimiter between crumbs
$home = 'Home'; // text for the 'Home' link
$showCurrent = 1; // 1 - show current post/page title in breadcrumbs, 0 - don't show
$before = '<span class="current">'; // tag before the current crumb
@surdaft
surdaft / humanize.php
Last active August 7, 2017 11:46
Humanize camelCase / PascalCase words
<?php
// Humanize pascalCase / camelCase
// http://stackoverflow.com/questions/4519739#answer-7729790
$regex = '/(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])/x';
$example = 'GooglePlus';
$converted = implode(' ', preg_split($regex, $example));