Skip to content

Instantly share code, notes, and snippets.

View dpdexter's full-sized avatar

David Dexter dpdexter

View GitHub Profile
# Shell prompt based on the Solarized Dark theme.
# Screenshot: http://i.imgur.com/EkEtphC.png
# Heavily inspired by @necolas’s prompt: https://github.com/necolas/dotfiles
# iTerm → Profiles → Text → use 13pt Monaco with 1.1 vertical spacing.
if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then
export TERM='gnome-256color';
elif infocmp xterm-256color >/dev/null 2>&1; then
export TERM='xterm-256color';
fi;
@dpdexter
dpdexter / gist:164803d46d7b495f87c2
Created February 20, 2015 20:08
show table field names
SELECT `COLUMN_NAME`
FROM `INFORMATION_SCHEMA`.`COLUMNS`
WHERE `TABLE_SCHEMA`='yourdbname'
AND `TABLE_NAME`='yourtablename';
SELECT
c.title as category_title,
c.url_title as category_url_title,
c.image as category_image
FROM
exp_br_category c,
exp_br_product_category pc
WHERE
c.parent_id = 93
AND
@dpdexter
dpdexter / gist:6602456
Created September 17, 2013 23:55
BR 1.3.4.3 (dev release) patch for free shipping bug
function _producttype_multiselect($product_id,$attribute_id,$title,$label,$required,$val,$opts = ''){
$class = ($required == 1) ? 'required' : '' ;
$input_title = ($required == 1) ? $label.' '.lang('br_is_required') : $label ;
$options = '';
##### BEGIN PATCH: ADD THIS BELOW THE OPTIONS VARIABLE ######
// Check to make sure the value is not serialized
$data = @unserialize($val);
@dpdexter
dpdexter / gist:5154156
Created March 13, 2013 17:09
Remove .DS_Store
find . -name *.DS_Store -type f -exec rm {} \;
{exp:query sql="
SELECT
title as category_title,
url_title as category_url_title,
image as category_image,
FROM exp_br_category,
WHERE parent_id = 0
ORDER BY sort
"}
@dpdexter
dpdexter / gist:4207649
Created December 4, 2012 19:14
BrilliantRetail - Change product display price when options are selected.
{exp:brilliant_retail:js}
var price,newPrice,qty,opt,adj;
$(function(){
price = parseInt($('p.price').html().replace('$',''))*1;
$('select','.product-options')
.change(function(){
qty = $('option:selected','#qty_select').val();
newPrice = price;
@dpdexter
dpdexter / gist:3228636
Created August 1, 2012 16:44
BrilliantRetail + Structure Patch
UPDATE exp_extensions SET priority = 99 WHERE class = 'Brilliant_retail_ext' AND method = 'br_template_post_parse';
@dpdexter
dpdexter / gist:1432288
Created December 5, 2011 04:24
_search_index
function _search_index($queryStr){
// Need at least 3 characters for wildcard searches
if(strlen($queryStr) >= 3){
// Dashes don't play nicely with our wildcard search
$queryStr = str_replace("-"," ",$queryStr).'*';
}
ini_set('include_path',ini_get('include_path').PATH_SEPARATOR.PATH_THIRD.'brilliant_retail'.DIRECTORY_SEPARATOR.'core'.DIRECTORY_SEPARATOR.'library'.DIRECTORY_SEPARATOR.PATH_SEPARATOR);
include_once(PATH_THIRD.'brilliant_retail'.DIRECTORY_SEPARATOR.'core'.DIRECTORY_SEPARATOR.'library'.DIRECTORY_SEPARATOR.'Zend'.DIRECTORY_SEPARATOR.'Search'.DIRECTORY_SEPARATOR.'Lucene.php');
Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_TextNum_CaseInsensitive());
@dpdexter
dpdexter / gist:1340855
Created November 5, 2011 00:21
Promo validation returns false positive on disabled promotions
function _validate_promo_code($code){
if($code["enabled"] == 0){ return false; }
if($code["uses_per"] > 0){
$cnt = $this->EE->promo_model->get_promo_use_count($code["code"]);
if($cnt >= $code["uses_per"]){
return false;
}
}