Skip to content

Instantly share code, notes, and snippets.

View vagelisp's full-sized avatar
👋

Vagelis P. vagelisp

👋
View GitHub Profile
@vagelisp
vagelisp / criticalcss-bookmarklet-devtool-snippet.js
Created November 18, 2016 13:48 — forked from PaulKinlan/criticalcss-bookmarklet-devtool-snippet.js
CriticalCSS Bookmarklet and Devtool Snippet.js
(function() {
var CSSCriticalPath = function(w, d, opts) {
var opt = opts || {};
var css = {};
var pushCSS = function(r) {
if(!!css[r.selectorText] === false) css[r.selectorText] = {};
var styles = r.style.cssText.split(/;(?![A-Za-z0-9])/);
for(var i = 0; i < styles.length; i++) {
if(!!styles[i] === false) continue;
var pair = styles[i].split(": ");
@vagelisp
vagelisp / critcss.snippet.js
Created February 15, 2017 13:32 — forked from pibby/critcss.snippet.js
Critical CSS Finder w/media query support for those of us who write mobile-first CSS; will output to console; configurable viewport height on line 12.
/* Critical CSS Finder w/media query support and output to console
by Katie Harron - https://github.com/pibby - https://pibby.com
forked from james-Ballyhoo (https://gist.github.com/james-Ballyhoo/04761ed2a5778c505527) who forked from PaulKinlan (https://gist.github.com/PaulKinlan/6284142)
I don't know why this isn't keeping my 2 space indents :(
*/
(function() {
function findCriticalCSS(w, d) {
// Pseudo classes formatting
var formatPseudo = /([^\s,\:\(])\:\:?(?!not)[a-zA-Z\-]{1,}(?:\(.*?\))?/g;
@vagelisp
vagelisp / gist:6e66060642787d5e8849154522b9c928
Created October 26, 2018 14:07
Responsive Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body {
text-align: center;
padding: 150px;
}
h1 {
font-size: 50px;
add_action( 'woocommerce_cart_calculate_fees','custom_tax_surcharge_for_retailers', 10, 1 );
function custom_tax_surcharge_for_retailers( $cart ) {
if ( is_admin() && ! defined('DOING_AJAX') ) return;
global $woocommerce;
if ( isset( $_POST['post_data'] ) ) {
parse_str( $_POST['post_data'], $post_data );
} else {
$post_data = $_POST;
}
//remove the text {PHP}
add_filter( 'woocommerce_product_add_to_cart_text', 'change_text_woo' );
function change_text_woo() {
return;
}
//add the icon {CSS}
a.button.product_type_simple.add_to_cart_button.ajax_add_to_cart:after {
content: "\f111";
font-family: dashicons;
function post_change_expired_function_new () {
if (is_admin()):
return;
endif;
if (is_single()):
$offer_coupon_date = get_post_meta( $post->ID, 'rehub_offer_coupon_date', true );
$timestamp1 = strtotime($offer_coupon_date) + 86399;
$seconds = $timestamp1 - (int)current_time('timestamp',0);
$days = floor($seconds / 86400);
$seconds %= 86400;
<?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
<?php global $post;?>
<?php
$columns = (isset($columns)) ? $columns : '';
$aff_link = (isset($aff_link)) ? $aff_link : '';
if(!isset($disable_btn)){
$disable_btn = (rehub_option('rehub_enable_btn_recash') == 1) ? 0 : 1;
}
$gridtype = (isset($gridtype)) ? $gridtype : '';
if(rehub_option('disable_btn_offer_loop')){
@vagelisp
vagelisp / functions.php
Last active June 7, 2019 22:24
Merge WC product tabs ( Description + Additional info )
add_filter( 'woocommerce_product_tabs', 'vagelis_dev_merge_tabs', 99 );
function vagelis_dev_merge_tabs( $tabs ) {
$tabs['description']['callback'] = function() {
global $product;
the_content();
do_action( 'woocommerce_product_additional_information', $product );
};
unset( $tabs['additional_information'] );
return $tabs;
@vagelisp
vagelisp / custom.js
Last active June 8, 2019 21:21
JS for Aggelos
jQuery(document).ready(function() {
jQuery("[id^=quform_10_218_]").change(function(event) {
jQuery("[id^=quform_10_1]")
.find("option:selected")
.removeAttr("selected");
jQuery("[id^=quform_10_1]").val("");
jQuery("[id^=quform_10_1]").change();
jQuery("[id^=quform-form]").closest('form').trigger("reset");
});
});
/**
* Exclude products from a particular category on the shop page
*/
function hide_products_in_unc( $q ) {
$tax_query = (array) $q->get( 'tax_query' );
$tax_query[] = array(
'taxonomy' => 'product_cat',
'field' => 'slug',
'terms' => array( 'uncategorized' ),
'operator' => 'NOT IN'