Skip to content

Instantly share code, notes, and snippets.

View mhackersu's full-sized avatar
🐧
tokimeku

Mike Hacker mhackersu

🐧
tokimeku
View GitHub Profile
/*
* Disable Continue shopping message after add to cart.
*/
add_filter( 'wc_add_to_cart_message', function( $string, $product_id = 0 ) {
$start = strpos( $string, '<a href=' ) ?: 0;
$end = strpos( $string, '</a>', $start ) ?: 0;
return substr( $string, $end ) ?: $string;
} );
/*
* External domains for add to cart redirect
*/
add_filter( 'allowed_redirect_hosts', function( $hosts ) {
$hosts[] = 'staging.energyefficientsolutions.com'; // Add your external domain in here.
/* No http/https schema prefix. Duplicate for additional allowed domains */
return $hosts;
} );
/**
* Allow rendering of checkout and account pages in iframes.
*/
add_action( 'after_setup_theme', 'wc_remove_frame_options_header', 11 );
function wc_remove_frame_options_header() {
remove_action( 'template_redirect', 'wc_send_frame_options_header' );
}
@mhackersu
mhackersu / gist:919232e99aaec26afdeba08053ed0f6b
Created November 26, 2018 22:34 — forked from MindyPostoff/gist:00f623326db4daa50394
Custom URL for the Continue Shopping button in WooCommerce Cart
/**
* Redirect the Continue Shopping URL from the default (most recent product) to
* a custom URL.
* Place this code snippet in your theme's functions.php file.
*/
function custom_continue_shopping_redirect_url ( $url ) {
$url = "http://www.woothemes.com"; // Add your link here
return $url;
}
add_filter('woocommerce_continue_shopping_redirect', 'custom_continue_shopping_redirect_url');
@mhackersu
mhackersu / functions.php
Created November 26, 2018 20:50 — forked from shivapoudel/functions.php
WooCommerce - Allow rendering of checkout and account pages in iframes
<?php // Do not include this if already open!
/**
* Code goes in theme functions.php.
*/
add_action( 'after_setup_theme', 'wc_remove_frame_options_header', 11 );
/**
* Allow rendering of checkout and account pages in iframes.
*/
@mhackersu
mhackersu / call_fedex.asp
Created October 22, 2018 18:45
Calling a FedEx Rate Service from Classic ASP with SOAP
<% option explicit %>
<!--#include file="FedexAccountInfo.asp"-->
<%
Dim subscriberzip
Dim subscribercountry
Dim ShipmentDate
Dim xmlReq
Dim objhttp
Dim outstr
Dim NodeList
@@ -28,7 +28,7 @@
if (!string.IsNullOrEmpty(_orderID))
{
string sql = @" select c.CustomerID, c.FirstName, c.LastName, c.Address, c.Address2, c.City, c.State, c.Zip, c.Country, c.PhoneNumber, c.Extension, c.EmailAddress, ROUND(o.OrderTotal, 2) AS OrderTotal
string sql = @" select c.CustomerID, c.FirstName, c.LastName, c.Address, c.Address2, c.City, c.State, c.Zip, c.Country, c.PhoneNumber, c.Extension, c.EmailAddress, ROUND(o.OrderTotal, 2) AS OrderTotal, o.OrderKey
from customers c
join orders o
on c.CustomerID = o.CustomerID
@mhackersu
mhackersu / css-drawer.markdown
Last active October 16, 2019 22:11
CSS Drawer
@mhackersu
mhackersu / gulpfile.js
Created January 11, 2018 00:38
A nice little Gulpfile for doing Front-End Development (SASS, Compression, Dist Build)
//initialize all of our variables
var app, base, concat, directory, gulp, gutil, hostname, path, refresh, sass, uglify, imagemin, minifyCSS, del, browserSync, autoprefixer, gulpSequence, shell, sourceMaps, plumber;
var autoPrefixBrowserList = ['last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4'];
//load all of our dependencies
//add more here if you want to include more libraries
gulp = require('gulp');
gutil = require('gulp-util');
concat = require('gulp-concat');
@mhackersu
mhackersu / express.js
Created January 11, 2018 00:37
A little Express.JS static HTTP server
+var express = require('express');
+var app = express();
+var server = require('http').Server(app);
+
+app.set('port', (process.env.PORT || 3000));
+
+app.use(express.static(__dirname + '/dist'));
+
+app.listen(app.get('port'), function() {
+ console.log('Node app on port', app.get('port'))