Skip to content

Instantly share code, notes, and snippets.

View doginthehat's full-sized avatar

Ben doginthehat

View GitHub Profile
@doginthehat
doginthehat / gist:9a46d8d4bd52539c983d
Created July 9, 2014 08:09
Increase number of decimals in all Lemonstand V1 currency fields to 4
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 ) ;
@doginthehat
doginthehat / gist:3735729
Created September 17, 2012 05:37
Import tab indented sitemap into wordpress
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 / gist:3956860
Created October 26, 2012 04:47
Responsive bootstrap popover
@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 / .htaccess
Created November 16, 2015 22:34
Fix missing images
# 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 January 31, 2018 09:45
Wordpress Pages -> Menu
/*
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.
*/
find . -name '*.svg' -exec bash -c 'svg2png {} `basename {} .svg`.png' \;
@doginthehat
doginthehat / whatis-handlebar.js
Created February 28, 2012 00:11
whatis - a simple debug helper for handlebars
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 May 12, 2023 20:13
compare block helper for handlebars
// {{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/)