Skip to content

Instantly share code, notes, and snippets.

Will Brubaker WillBrubaker

Block or report user

Report or block WillBrubaker

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@WillBrubaker
WillBrubaker / song-liker.js
Created Nov 1, 2019
like a song on spotify
View song-liker.js
#!/usr/local/bin/node
//https://www.thathandsomebeardedguy.com/i'd-love-to-❤️-you-more
var args = process.argv.slice( 2 )[ 2 ];
var trackId;
songURI = args.match( '^.*track:([a-zA-Z0-9]+)' )[ 1 ];
//npm install fs
var fs = require( "fs" );
var file = "token.txt";
//npm install scp
var scp = require( 'scp' );
View token-refresher.js
//https://www.thathandsomebeardedguy.com/i'd-love-to-❤️-you-more
var credentials = {
clientId: 'someclientid',
clientSecret: 'someclientsecret',
redirectUri: 'http://localhost:8888/callback'
};
//npm install spotify-web-api-node --save
var SpotifyWebApi = require('spotify-web-api-node');
var spotifyApi = new SpotifyWebApi(credentials);
//npm install fs
@WillBrubaker
WillBrubaker / file.php
Created Jul 12, 2019
Prevent adding the tax rate to WooCommerce Xero tax label
View file.php
//not sure what to do with this code snippet? See https://www.thathandsomebeardedguy.com/what-do-i-do-with-these-code-snippets/
add_filter( 'woocommerce_xero_create_unique_tax_label', '__return_false' );
@WillBrubaker
WillBrubaker / file.php
Created Jun 12, 2019
Default to checked "Update the Billing Address used for all of my active subscriptions (optional)" - WooCommerce Subscriptions
View file.php
//not sure what to do with this code snippet? See https://www.thathandsomebeardedguy.com/what-do-i-do-with-these-code-snippets/
add_filter( 'wcs_update_all_subscriptions_addresses_checked', '__return_true' );
@WillBrubaker
WillBrubaker / file.php
Created Dec 19, 2018
WooCommerce default variation manage stock checked
View file.php
//not sure what to do with this code snippet? See https://www.thathandsomebeardedguy.com/what-do-i-do-with-these-code-snippets/
if ( is_admin() ) {
add_filter( 'woocommerce_product_variation_get_manage_stock', '__return_true' );
}
@WillBrubaker
WillBrubaker / file.php
Created Dec 16, 2018
Remove 'via WooCommerce' from Stripe Payment Request
View file.php
//not sure what to do with this code snippet? See https://www.thathandsomebeardedguy.com/what-do-i-do-with-these-code-snippets/
add_filter( 'wc_stripe_payment_request_total_label_suffix', '__return_empty_string' );
@WillBrubaker
WillBrubaker / file.php
Created Dec 12, 2018
WooCommerce redirect to cart if trying to add a 'sold individually' item that is already in the cart
View file.php
//not sure what to do with this code snippet? See https://www.thathandsomebeardedguy.com/what-do-i-do-with-these-code-snippets/
add_filter( 'woocommerce_add_to_cart_sold_individually_found_in_cart', 'handsome_bearded_guy_maybe_redirect_to_cart' );
function handsome_bearded_guy_maybe_redirect_to_cart( $found_in_cart ) {
if ( $found_in_cart ) {
wp_safe_redirect( wc_get_page_permalink( 'cart' ) );
exit;
}
@WillBrubaker
WillBrubaker / file.php
Last active Dec 12, 2018
WooCommerce Stripe data-locale="auto"
View file.php
//not sure what to do with this code snippet? See https://www.thathandsomebeardedguy.com/what-do-i-do-with-these-code-snippets/
add_filter( 'wc_stripe_checkout_locale', 'handsome_bearded_guy_stripe_checkout_locale' );
function handsome_bearded_guy_stripe_checkout_locale() {
return 'auto';
}
@WillBrubaker
WillBrubaker / file.php
Created Dec 6, 2018
Remove add to cart button from products that do not have stock
View file.php
//not sure what to do with this code snippet? See https://www.thathandsomebeardedguy.com/what-do-i-do-with-these-code-snippets/
add_filter( 'woocommerce_loop_add_to_cart_link', 'handsome_bearded_guy_maybe_remove_add_to_cart_button' );
function handsome_bearded_guy_maybe_remove_add_to_cart_button( $html ) {
global $product;
if ( 'simple' === $product->get_type() && ! $product->get_stock_quantity() ) {
return null;
}
return $html;
}
@WillBrubaker
WillBrubaker / file.php
Last active Dec 6, 2018
Add UAE Emirates to WooCommerce
View file.php
//not sure what to do with this code snippet? See https://www.thathandsomebeardedguy.com/what-do-i-do-with-these-code-snippets/
add_filter( 'woocommerce_states', 'add_uae_emirates' );
function add_uae_emirates( $states ) {
$states['AE'] = array(
'AZ' => __( 'Abu Dhabi', 'woocommerce' ),
'AJ' => __( 'Ajman', 'woocommerce' ),
'FU' => __( 'Fujairah', 'woocommerce' ),
'SH' => __( 'Sharjah', 'woocommerce' ),
'DU' => __( 'Dubai', 'woocommerce' ),
You can’t perform that action at this time.