Skip to content

Instantly share code, notes, and snippets.

View salvatorecapolupo's full-sized avatar
🎯
Focusing

Salvatore Capolupo salvatorecapolupo

🎯
Focusing
View GitHub Profile
@salvatorecapolupo
salvatorecapolupo / Coffescript -> JS conversion
Last active June 29, 2016 16:13
coffeescript basic: how to install and basic massive compiling
# Using Mac you will need importing cooffe-script library:
sudo npm install -g coffee-script
# now you can convert cooffee-scripts ("compressed" version of a normal javascript file) into more familiar JS, i.e
coffee -c --output gamejs/ game/
#which converts all file into game/ in a new directory called gamejs/.
Elenco di guide che ho scritto e pubblicato sul web in questi anni.
@salvatorecapolupo
salvatorecapolupo / Guide per WordPress
Last active June 30, 2016 07:01
Guide per sviluppatori WordPress
Lista di risorse gratuite dedicate agli sviluppatori WP.
@salvatorecapolupo
salvatorecapolupo / Basic WordPress Bootstrap 3.3.7 integration
Created June 18, 2017 08:37
Correct way to recreate basic HTML file as targeted on "Get started" Bootstrap official page.
<?PHP
add_action('wp_enqueue_scripts', 'headwolf_enqueues' );
function headwolf_enqueues(){
//bootstrap.min.css
wp_enqueue_style('bootstrap2017', get_stylesheet_directory_uri() . '/css/bootstrap.min.css', array(), '3.3.7');
//HTML5 shim + Respond.js for IE8 support
global $wp_scripts;
wp_enqueue_script('modernizr-script', get_template_directory_uri() . '/js/vendor/modernizr.min.js', array(), '3.3.1');
wp_register_script('respond-script', get_template_directory_uri() . '/js/vendor/respond.min.js', array(), '1.4.2');
@salvatorecapolupo
salvatorecapolupo / Universal SEO mu-plugin.php
Created July 14, 2017 09:49
Put this file on your mu-plugins WordPress directory, and map your custom URL, title, meta-description as a CSV file. Used i.e http://rubbettinoprint.it/
<?php
/**
*
* Plugin Name: Universal SEO Plugin
* Description: Set and overwrite title/meta description via url, i.e mapped in a .txt file
* Author: Salvatore Capolupo
* Version: 1.0
* Author URI: http://www.rubbettinoprint.it
*/
@salvatorecapolupo
salvatorecapolupo / wordpress_dontneeds.php
Created July 16, 2017 13:36
All you don't really need in WP. Please disable carefully!
<?PHP
//note: you should use these hook in functions.php file and / or (mu)plugin
//disable WordPress emoji
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
//disable Gravatars support
function __default_local_avatar()
# funziona in modo ricorsivo per tutti i file nella directory corrente
# va bene per le immagini di un sito per risparmiare banda e spazio
#prima passata: ricampiona a 960px massimo di altezza, formatta a compressione 80
find . -type f -name '*.jpg' -exec sips -s formatOptions 80 --resampleHeight 960 {} \;
#seconda passata: solo per i file grossi
find . -type f -size +1M -name '*.jpg' -exec sips -s formatOptions 35 --resampleHeight 960 {} \;
#terza ed ultima passata: togliere di mezzo gli EXIF
@salvatorecapolupo
salvatorecapolupo / noduplicates.sql
Last active September 9, 2022 06:29
WordPress find post duplicates via MySQL query - Used to remove duplicated posts from WordPress - i.e https://www.lipercubo.it, https://capolooper.it
SELECT a.ID, a.post_title, a.post_type, a.post_status
FROM wp_posts AS a
INNER JOIN (
SELECT post_title, MIN( id ) AS min_id
FROM wp_posts
WHERE post_type = 'post'
AND post_status = 'publish'
GROUP BY post_title
HAVING COUNT( * ) > 1
) AS b ON b.post_title = a.post_title
@salvatorecapolupo
salvatorecapolupo / GDPR Privacy Policy Template
Last active May 6, 2018 09:04
Base template for Privacy Policy for any website (source: https://it.wordpress.org/plugins/gdpr-framework/) - Please not this is NOT a legal advice: you may need to focus other things not reported here. Sharing is helpful for us, but mindless copy-paste is useless.
<h2>Privacy Policy</h2>
is committed to safeguarding your privacy. Contact us at if you have any questions or problems regarding the use of your Personal Data and we will gladly assist you.
By using this site or/and our services, you consent to the Processing of your Personal Data as described in this Privacy Policy.
<h3>Table of Contents</h3>
<ol>
<li><a href="#gdpr-definitions">Definitions used in this Policy</a></li>
<li><a href="#gdpr-principles">Data protection principles we follow</a></li>
<li><a href="#gdpr-rights">What rights do you have regarding your Personal Data</a></li>
<li><a href="#gdpr-information">What Personal Data we gather about you</a></li>