Skip to content

Instantly share code, notes, and snippets.

@danilinked
danilinked / no_urls_allowed.php
Created August 26, 2024 09:52 — forked from galbaras/no_urls_allowed.php
Function to invalidate Contact Form 7 input, unless the fields is of type "url" or has "url" in its name, i.e. it is meant for URLs
add_filter( 'wpcf7_validate_text', 'no_urls_allowed', 10, 3 );
add_filter( 'wpcf7_validate_text*', 'no_urls_allowed', 10, 3 );
add_filter( 'wpcf7_validate_textarea', 'no_urls_allowed', 10, 3 );
add_filter( 'wpcf7_validate_textarea*', 'no_urls_allowed', 10, 3 );
function no_urls_allowed( $result, $tag ) {
$tag = new WPCF7_Shortcode( $tag );
$type = $tag->type;
$name = $tag->name;
@danilinked
danilinked / clean-db.sql
Created March 1, 2023 22:04 — forked from Ndrou/clean-db.sql
Clean prestashop 1.6 database
DELETE FROM ps_accessory WHERE id_product_1 NOT IN (select p.id_product from ps_product p);
DELETE FROM ps_accessory WHERE id_product_2 NOT IN (select p.id_product from ps_product p);
DELETE FROM ps_address WHERE id_customer NOT IN (select c.id_customer from ps_customer c);
DELETE FROM ps_product_comment WHERE id_product NOT IN (select p.id_product from ps_product p);
DELETE FROM ps_product_comment_grade WHERE id_product_comment NOT IN (select pc.id_product_comment from ps_product_comment pc);
DELETE FROM ps_product_comment_usefulness WHERE id_product_comment NOT IN (select pc.id_product_comment from ps_product_comment pc);
DELETE FROM ps_product_lang WHERE id_product NOT IN (select p.id_product from ps_product p);
@danilinked
danilinked / media-query.css
Created May 11, 2022 15:27 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
/* CSS */
@danilinked
danilinked / hosts
Created March 15, 2022 14:06 — forked from consti/hosts
/etc/hosts to block shock sites etc.
# This hosts file is brought to you by Dan Pollock and can be found at
# http://someonewhocares.org/hosts/
# You are free to copy and distribute this file for non-commercial uses,
# as long the original URL and attribution is included.
#<localhost>
127.0.0.1 localhost
127.0.0.1 localhost.localdomain
255.255.255.255 broadcasthost
::1 localhost
@danilinked
danilinked / Sistrix-Export-Clusters.js
Created August 13, 2021 11:45 — forked from natzir/Sistrix-Export-Clusters.js
Bookmark to extract Sistrix keyword clusters
javascript:(function(){output="<html><head><title>Sistrix Clusters by @Natzir9</title></head><body><button onclick=\"tableToExcel('sistrixTable','Sistrix Clusters')\">Export Sistrix Clusters</button><table%20id=\"sistrixTable\"><tr><th>Keyword</th><th>Count</th><th>Volume</th></tr>";var myValue=document.getElementById('sidebar').getElementsByClassName('value number');for(var i=0;i<myValue.length;i+=3){output=output+"<tr><td>"+myValue[i].innerText+"</td><td>"+myValue[i+1].innerText+"</td><td>"+Math.round(myValue[i+2].innerText)+"</td></tr>";};output+="</table>";with(window.open()){document.write(output);document.body.appendChild(document.createElement('script')).src='https://bl.ocks.org/insin/raw/1031969/tableToExcel.js';document.close();}})();
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@danilinked
danilinked / woocommerce-edits.php
Created September 19, 2017 17:23 — forked from mircobabini/woocommerce-edits.php
woocommerce useful actions
<?php
/**
* @author Mirco Babini, SED Web Italia
*
* Contents:
* - reset payment method on 'add to cart'
* - add message to (customer) email per payment method
* - add payment method to email
* - remove product tabs
* - remove result count and default ordering (doesnt work?)
@danilinked
danilinked / woocommerce-composites-hide-cart-order-components.php
Created January 24, 2017 10:56 — forked from manospsyx/woocommerce-composites-hide-cart-order-components.php
Use this snippet to hide Components in the cart, checkout, order and e-mail templates
<?php
/**
* Plugin Name: WooCommerce Composite Products - Hide Components in all Templates
* Plugin URI: http://www.woothemes.com/products/composite-products/
* Description: Use this snippet to hide Components in the cart, checkout, order and e-mail templates.
* Version: 1.0
* Author: SomewhereWarm
* Author URI: http://www.somewherewarm.net/
* Developer: Manos Psychogyiopoulos
*
// Original code form http://www.blog.highub.com/mobile-2/a-fix-for-iphone-viewport-scale-bug/
var metas = document.getElementsByTagName('meta');
var i;
if (navigator.userAgent.match(/iPhone/i)) {
for (i=0; i<metas.length; i++) {
if (metas[i].name == "viewport") {
metas[i].content = "width=device-width, minimum-scale=1.0, maximum-scale=1.0";
}
}