This file contains hidden or 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 | |
/** | |
* Adjust image quality to 100 | |
*/ | |
function mamaduka_adjust_quality( $image )) { | |
$image->set_quality(100); | |
return $image | |
} | |
add_filter( 'image_editor_save_pre', 'mamaduka_adjust_quality' ); |
This file contains hidden or 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 | |
/** | |
* Disable Browse Happy | |
*/ | |
function because_im_happy() { | |
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) { | |
return false; | |
} | |
This file contains hidden or 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
li.share-mwp a::before { | |
content: url('mwp.png'); | |
} |
This file contains hidden or 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or 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 | |
/** | |
* Plugin Name: WooCommerce Email Customer Address | |
* Plugin URI: https://gist.github.com/BFTrick/7891074 | |
* Description: Email the site admin when a customer changes their address | |
* Author: Patrick Rauland | |
* Author URI: http://patrickrauland.com/ | |
* Version: 1.1 | |
* | |
* This program is free software: you can redistribute it and/or modify |
This file contains hidden or 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 | |
/** | |
* Exclude comments for specific posts. | |
* 250 and 270 are post IDs | |
*/ | |
function mamaduka_where_clauses( $clauses ) { | |
global $wpdb; | |
$clauses['where'] .= " AND ( $wpdb->comments.comment_post_ID NOT IN ( 250, 270 ) )"; |
This file contains hidden or 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
# shortform git commands | |
alias g='git' | |
# add a tag | |
git tag -a 1.2 -m "Version 1.2 Stable" | |
# push tags | |
git push --tags | |
# download all files from a gist without git |
This file contains hidden or 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
echo "Creating an SSH key for you..." | |
ssh-keygen -t rsa | |
echo "Please add this public key to Github \n" | |
echo "https://github.com/account/ssh \n" | |
read -p "Press [Enter] key after this..." | |
echo "Installing xcode-stuff" | |
xcode-select --install |
This file contains hidden or 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 | |
$file = '/path/to/image.png'; | |
$editor = wp_get_image_editor( $file ); | |
// true for hard crop | |
$editor->resize( 300, 300, true ); | |
// use crop for more advanced cropping, positioning etc. |