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
<input type="text" class="text" name="mobilePhone" id="mobilePhone" value="" parsley-regex-message="Please enter a valid Australian mobile phone number." parsley-regexp="^\(?(?:\+?61|0)4\)?(?:[ -]?[0-9]){2}\)?(?:[ -]?[0-9]){5}[0-9]$"/> |
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
ln -s /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl /bin/sublime |
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 | |
echo "Enter ssh username & host you want to add your key to in the following format: username@host.com" | |
read host | |
IP=$(curl -Sfs https://wtfismyip.com/text) | |
KEY=$(cat ~/.ssh/id_rsa.pub) | |
echo 'Adding Key to '$host': from="'$IP'"' $KEY | |
echo 'from="'$IP'"' $KEY | ssh $host 'cat >> ~/.ssh/authorized_keys' | |
exit; |
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
wget http://wordpress.org/latest.tar.gz && tar xfz latest.tar.gz && rm -rf wordpress/wp-content/ && mv wordpress/* ./ && rm -rf wordpress/ && rm -rf latest.tar.gz |
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
# for the things I rarely do but often forget | |
# copy files via ssh | |
scp foobar.txt your_username@remotehost.com:/some/remote/directory |
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" |