Skip to content

Instantly share code, notes, and snippets.

View michaeltieso's full-sized avatar
🕶️

Michael Tieso michaeltieso

🕶️
View GitHub Profile

Deploy Rails app to Digital Ocean with nginx, unicorn, capistrano & postgres

Create droplet of your liking (ubuntu 12.10 x32)

ssh to root in terminal with your server ip

ssh [email protected]

s Add ssh fingerprint and enter password provided in email

@michaeltieso
michaeltieso / Removing nRelate from WooCommerce Pages
Created March 26, 2014 21:55
Posted below is what you will need to add to your themes function.php to disable nRelate on WooCommerce's pages.
function hide_nrelate_from_posts($load_nrelate) {
if ( is_woocommerce() ) {
$load_nrelate = false;
}
return $load_nrelate;
}
add_filter('nrelate_related_is_loading', 'hide_nrelate_from_posts');
// Check the name of your addon field in the source. Example: addon-7934-test-addon
jQuery( "input[name='addon-7934-test-addon']" ).datepicker( {
minDate: 0,
"dateFormat": 'yy-mm-dd'
} );
@michaeltieso
michaeltieso / gist:10561ac9571a94a2104d
Created July 18, 2014 14:23
Default values for Product Add-ons
// Set default value to 0 for Custom price input
jQuery(document).ready(function(){
jQuery('.addon-custom-price').val("0");
});
@michaeltieso
michaeltieso / gist:0068bf05f4ad64577e54
Created September 22, 2014 20:17
Dynamic Pricing + Product Add-ons
add_action( 'woocommerce_before_calculate_totals', 'add_custom_price' );
function add_custom_price( $cart_object ) {
foreach ( $cart_object->cart_contents as $key => $value ) {
$addons = $value['addons'];
$add_to_price = 0;
foreach($addons as $addon) {
$add_to_price .= $addon['price'];
@michaeltieso
michaeltieso / My config.fish
Created September 6, 2018 08:12
Inserted into ~/.config/fish/config.fish
# Greating when starting terminal
function fish_greeting
set_color green
echo -n "Welcome, Michael."
end
# fish git prompt
set __fish_git_prompt_showdirtystate 'yes'
set __fish_git_prompt_showstashstate 'yes'
set __fish_git_prompt_showupstream 'yes'
@michaeltieso
michaeltieso / Display Bulk Pricing Rules
Last active October 15, 2018 08:53
Displays bulk pricing rules on product pages from WooCommerce Dynamic Pricing.
function mdt_woo_pricing_rules() {
global $post;
$pricing_rule_sets = apply_filters( 'dynamic_pricing_product_rules', get_post_meta( $post->ID, '_pricing_rules', true ) );
if ( ! is_array( $pricing_rule_sets ) ) {
return [ ];
}
$product = new WC_Product(get_the_ID());
$price = $product->get_price();
@michaeltieso
michaeltieso / Gutenburg Default Colors
Created May 31, 2020 16:22
Gutenburg Default Colors
/**
* Gutenburg Default Colors
*/
add_theme_support( 'editor-color-palette', array(
array(
'name' => __( 'Ecru', 'custom_colors' ),
'slug' => 'ecru',
'color' => '#BCAF83',
),
array(
# Code to make sure WooCommerce Subscription URL does not update during a Search and Replace script.
# Add to your themes functions.php file
# Replace https://example.com with your live URL
if (class_exists('WC_Subscriptions')) {
function wc_subs_live_url() {
update_option( 'wc_subscriptions_siteurl', 'https://example.com' );
}
add_action('init', 'wc_subs_live_url');
}