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
<?php | |
function getConnection() { | |
$dbhost="127.0.0.1"; | |
switch(ENV){ | |
case 'dev': | |
$dbuser="username"; | |
$dbpass="password"; | |
$dbname="databasename"; |
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
<?php | |
function my_wp_mail_from_name($name) { | |
return 'From Name'; | |
} | |
//email from email function | |
function my_wp_mail_from($content_type) { | |
return 'from@emailaddress.com.au'; | |
} | |
add_filter('wp_mail_from','my_wp_mail_from'); | |
add_filter('wp_mail_from_name','my_wp_mail_from_name'); |
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
<?php | |
if ( is_tax('platform')) { | |
$args = array( | |
'post_type' => 'post', | |
'post_status' => 'draft', | |
'tax_query' => array( | |
array( | |
'taxonomy' => 'platform', | |
'field' => 'slug', |
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 ordinal($number) { | |
$ends = array('th','st','nd','rd','th','th','th','th','th','th'); | |
if ((($number % 100) >= 11) && (($number%100) <= 13)) | |
return $number. 'th'; | |
else | |
return $number. $ends[$number % 10]; | |
} |
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
DB="DBNAME"; ( echo 'ALTER DATABASE `'"$DB"'` CHARACTER SET utf8 COLLATE utf8_general_ci;'; mysql -u root "$DB" -e "SHOW TABLES" --batch --skip-column-names | xargs -I{} echo 'ALTER TABLE `'{}'` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;' ) | mysql -u root "$DB" |
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
/* Responsinator Bookmarklet - simply show the viewport width to make it easy to see what media-query is being applied. | |
*/ | |
(function(){ | |
var el=document.createElement('div'); | |
el.style.position='fixed'; | |
el.style.height='50'; | |
el.style.width='300'; | |
el.style.margin='-25px -150px 0 0'; | |
el.id='unitseven-size'; | |
el.style.top='50%'; |
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
find . -type d -exec chmod 0755 {} \; && find . -type f -exec chmod 0644 {} \; |
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
tar -czvf filename.tar.gz /full/path/to/directory --exclude "/full/path/to/directory/to/exclude/wp-content/uploads" | |
Use this on local /wp-content/uploads: | |
<IfModule mod_rewrite.c> | |
RewriteEngine on | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule (.*) http://domain.com/wp-content/uploads/$1 | |
</IfModule> |
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
_complete_ssh_hosts () | |
{ | |
COMPREPLY=() | |
cur="${COMP_WORDS[COMP_CWORD]}" | |
comp_ssh_hosts=`cat ~/.ssh/known_hosts | \ | |
cut -f 1 -d ' ' | \ | |
sed -e s/,.*//g | \ | |
grep -v ^# | \ | |
uniq | \ | |
grep -v "\[" ; |
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[href$=".pdf"]').click(function(){ | |
ga('send', { | |
hitType: 'event', | |
eventCategory: 'Download', | |
eventAction: 'PDF', | |
eventLabel: this.href | |
}); | |
}); |