This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BACKUP_DIR="~/db_backups" | |
DBUSER="" | |
DBPASSWORD="" | |
BUCKET="your-unique-bucket-name" | |
FROM='"Backups" <backups@localhost>' | |
TO='"Admin" <admin@localhost>' | |
SUBJECT='Backup Log' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// see also https://gist.github.com/3201854 | |
function mytheme_menu_tree__main_menu($variables) { | |
return '<select class="mobile-main-menu" onchange="location = this.options[this.selectedIndex].value;">' | |
. $variables['tree'] . '</select>'; | |
} | |
function mytheme_menu_link__main_menu($variables) { | |
global $base_url; | |
$e = $variables['element']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Apply a template to all subcategories of a certain parent category. | |
* | |
* Initial work by Jared Atchison. | |
* http://www.jaredatchison.com/2011/10/02/taking-advantage-of-the-template_include-filter/ | |
* | |
* Revisited by GaryJones https://gist.github.com/GaryJones/1258784 | |
* https://gist.github.com/GaryJones/1258784 | |
* | |
* An improved version of the original Jared/Gary version which checks for, in order, the presence of the templates: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Language list Code for non-Widget users | |
* | |
* @global array $q_config | |
* @param string $sep | |
*/ | |
function qtrans_generate_language_list($sep = " | ") { | |
global $q_config; | |
$languages = qtrans_getSortedLanguages(); | |
$num_langs = count($languages); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Hide Standard Shipping option when free shipping is available | |
* | |
* @param array $available_methods | |
*/ | |
function sardbaba_hide_standard_shipping_when_free_is_available($available_methods) { | |
if (isset($available_methods['free_shipping']) AND isset($available_methods['flat_rate'])) { | |
// remove standard shipping option | |
unset($available_methods['flat_rate']); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Add the terms agreement field | |
*/ | |
function sardbaba_add_login_field() { | |
?> | |
<p class="forgetmenot"> | |
<label for="terms-agreement"> | |
<input name="terms-agreement" type="checkbox" id="terms-agreement" value="agree"> <?php _e( 'I Agree to the terms and conditions' ) ?> | |
</label> | |
</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
( function( $ ) { | |
$( window ).load( function() { | |
function supportsSVG() { | |
return !! document.createElementNS && !! document.createElementNS('http://www.w3.org/2000/svg','svg').createSVGRect; | |
} | |
if (!supportsSVG()) { | |
var imgs = document.getElementsByTagName('img'); | |
var dotSVG = /.*\.svg$/; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Drupal.settings.isTouchDevice = function() { | |
return "ontouchstart" in window; | |
} | |
if ( Drupal.settings.isTouchDevice() ) { | |
Drupal.behaviors.jQueryMobileSlideShowTouchAdvance = { | |
attach: function(context, settings) { | |
self = Drupal.behaviors.jQueryMobileSlideShowTouchAdvance; | |
jQuery.each(jQuery(".views_slideshow_cycle_main.viewsSlideshowCycle-processed"), function(idx, value) { | |
value.addEventListener("touchstart", self.handleTouchStart); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A textual language chooser widget compatible with qTranslate and qTranslate-slug | |
* Author: Mauro Mascia | |
* License: WTFPL (www.wtfpl.net) | |
*/ | |
class Widget_Language_Chooser extends WP_Widget { | |
function __construct() { | |
parent::__construct( | |
'widget_language_chooser', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Get or set the current outer width/height for the first element in the set of matched elements. */ | |
var origOuterWidth = $.fn.outerWidth; | |
$.fn.outerWidth = function(){ | |
var value = arguments[0]; | |
if (arguments.length === 0 || typeof value === 'boolean') { return origOuterWidth.apply(this, arguments); } | |
else if (typeof value !== 'number') { throw new Error('Invalid argument. The new outerWidth value must be an integer.'); } | |
var css = ['borderLeftWidth','borderRightWidth','paddingLeft','paddingRight']; | |
if (arguments[1] === true) { css.push('marginLeft'); css.push('marginRight'); } | |
var $el = $(this), exclude = 0, parse = parseFloat; | |
for (var i=0; i<css.length; i++) { exclude += parse($el.css(css[i])); } |
OlderNewer