Skip to content

Instantly share code, notes, and snippets.

Ben doginthehat

Block or report user

Report or block doginthehat

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@doginthehat
doginthehat / .htaccess
Created Nov 16, 2015
Fix missing images
View .htaccess
# For safe keeping
# From https://journalxtra.com/web-development/fix-missing-images-size-fits-replacement/
# Clever trick if you're working off a local dev copy and don't want to download all the media image to work
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} \.(gif|jpg|jpeg|png)$
RewriteRule .* directory-path/replacement-image.jpg [L]
@doginthehat
doginthehat / gist:d0c7fc1d1b5045d03af5
Last active Jan 31, 2018
Wordpress Pages -> Menu
View gist:d0c7fc1d1b5045d03af5
/*
Generate a hierachical menu based on the page structure of your wordpress website.
Useful if your late in the game in generating a menu, or updating an old website.
If you don't understand what it does, don't use it.
*/
@doginthehat
doginthehat / gist:9a46d8d4bd52539c983d
Created Jul 9, 2014
Increase number of decimals in all Lemonstand V1 currency fields to 4
View gist:9a46d8d4bd52539c983d
ALTER TABLE `core_metrics` MODIFY `total_amount` DECIMAL( 15, 4 ) ;
ALTER TABLE `shop_bundle_item_products` MODIFY `price_or_discount` DECIMAL( 15, 4 ) ;
ALTER TABLE `shop_extra_options` MODIFY `price` DECIMAL( 15, 4 ) ;
ALTER TABLE `shop_option_matrix_records` MODIFY `base_price` DECIMAL( 15, 4 ) ;
ALTER TABLE `shop_option_matrix_records` MODIFY `cost` DECIMAL( 15, 4 ) ;
View Convert all svg to png with svg2png
find . -name '*.svg' -exec bash -c 'svg2png {} `basename {} .svg`.png' \;
@doginthehat
doginthehat / gist:3956860
Created Oct 26, 2012
Responsive bootstrap popover
View gist:3956860
@media (min-width: 768px) and (max-width: 979px) {
.popover {
width:200px;
}
.popover-title {
padding: 4px 10px;
font-size: 14px;
line-height: 18px;
}
.popover-content {
@doginthehat
doginthehat / gist:3735729
Created Sep 17, 2012
Import tab indented sitemap into wordpress
View gist:3735729
define("LIPSUM","bacon");
$site = <<<EOF
Top Page
Sub Page 1
Sub Page 2
Sub Page 3
Top Page 2
Top Page 3
Top Page 4
@doginthehat
doginthehat / whatis-handlebar.js
Created Feb 28, 2012
whatis - a simple debug helper for handlebars
View whatis-handlebar.js
Handlebars.registerHelper('whatis', function(param, options) {
var label = options.hash.label ? options.hash.label + '=%o' : "%o";
try {
console && console.log && console.log(label,param);
options.hash.show_options && console && console.log && console.log("options=%o",options);
} catch (ex)
@doginthehat
doginthehat / gist:1890659
Last active Mar 16, 2019
compare block helper for handlebars
View gist:1890659
// {{compare unicorns ponies operator="<"}}
// I knew it, unicorns are just low-quality ponies!
// {{/compare}}
//
// (defaults to == if operator omitted)
//
// {{equal unicorns ponies }}
// That's amazing, unicorns are actually undercover ponies
// {{/equal}}
// (from http://doginthehat.com.au/2012/02/comparison-block-helper-for-handlebars-templates/)
You can’t perform that action at this time.