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
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Net.Http; | |
using System.Threading.Tasks; | |
namespace TestApp | |
{ | |
internal class Program | |
{ |
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
@echo off | |
:: https://stackoverflow.com/a/52688643/26877 | |
set dirname="" | |
set dirname=%* | |
set orig_dirname=%* | |
:: remove quotes - will re-attach later. | |
set dirname=%dirname:\"=% | |
set dirname=%dirname:/"=% |
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 | |
// https://stackoverflow.com/a/22818089/26877 | |
// wp-content/mu-plugins/buffer.php | |
/** | |
* Output Buffering | |
* | |
* Buffers the entire WP process, capturing the final output for manipulation. | |
*/ | |
ob_start(); |
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
;with product_types (object_id, product_type) as ( | |
select tr.object_id, t.name | |
from wp_term_relationships tr | |
join wp_term_taxonomy tax on tr.term_taxonomy_id = tax.term_taxonomy_id and tax.taxonomy = 'product_type' | |
join wp_terms t on t.term_id = tax.term_id | |
) | |
select | |
p.ID | |
,p.post_parent | |
,p.post_status |
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 my_plugins_update_completed( $upgrader_object, $options ) { | |
// If an update has taken place and the updated type is plugins and the plugins element exists | |
if ( $options['action'] == 'update' && $options['type'] == 'plugin' && isset( $options['plugins'] ) ) { | |
foreach( $options['plugins'] as $plugin ) { | |
// Check to ensure it's my plugin | |
if( $plugin == plugin_basename( __FILE__ ) ) { | |
// do stuff here | |
} | |
} |
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
/* actions fired when listing/adding/editing posts or pages */ | |
/* admin_head-(hookname) */ | |
add_action( 'admin_head-post.php', 'admin_head_post_editing' ); | |
add_action( 'admin_head-post-new.php', 'admin_head_post_new' ); | |
add_action( 'admin_head-edit.php', 'admin_head_post_listing' ); | |
function admin_head_post_editing() { | |
echo 'you are editing a post'; | |
} |
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 wc_get_first_parent($prod_id) { | |
$group_args = array( | |
'post_type' => 'product', | |
'meta_query' => array( | |
array( | |
'key' => '_children', | |
'value' => 'i:' . $prod_id . ';', | |
'compare' => 'LIKE', | |
) | |
), |
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
public static class IndexedEnumerable | |
{ | |
public static IndexedEnumerable<T> AsIndexedEnumerable<T>(this IEnumerable<T> source) | |
{ | |
return Create(source); | |
} | |
public static IndexedEnumerable<T> Create<T>(IEnumerable<T> source) | |
{ | |
return new IndexedEnumerable<T>(source); |
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
fcs() { | |
OUTPUT=$(dotnet format) | |
if [ $? -eq 0 ]; then | |
powershell -file $HOME/Toast.ps1 "Dotnet Format", "Completed successfully" | |
else | |
powershell -file $HOME/Toast.ps1 "Dotnet Format", "Failed $OUTPUT" | |
fi | |
} |
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
[user] | |
email = [email protected] | |
name = jeremy simmons | |
[alias] | |
# Get the current branch name (not so useful in itself, but used in other aliases) | |
branch-name = "!git rev-parse --abbrev-ref HEAD" | |
# Push the current branch to the remote "origin", and set it to track the upstream branch | |
publish = "!git push -u origin $(git branch-name)" | |
# Delete the remote version of the current branch |
NewerOlder