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 / track-click-analytics.js
Created September 1, 2019 10:58
Simple way to add utm_medium / utm_source to any inner link inside your website, as described well here: https://support.google.com/analytics/answer/1033867?hl=en
jQuery(document).ready(function( $ ){
//track single link
var original_link1 = jQuery("a#single").attr('href');
jQuery(elem).attr('href', original_link + '?utm_source=A&utm_medium=B&utm_campaign=C');
//track multi-links
var link_group_identifier = 'a.group';
jQuery( link_group_identifier ).each(function(i, elem) {
var original_link = jQuery(elem).attr('href');
@salvatorecapolupo
salvatorecapolupo / open-graph.html
Last active August 18, 2019 08:44
Facebook Open Graph HTML basic template
<meta property="og:locale" content="it_IT" />
<meta property="og:type" content="article" />
<meta property="og:title" content="Questo apparirà come titolo - This is title" />
<meta property="og:description" content="This is description - Questa invece sarà la descrizione del link corrispondente a questa pagina." />
<meta property="og:url" content="https://url.sito/path/" />
<meta property="og:site_name" content="URL Sito" />
<meta property="article:author" content="https://www.facebook.com/pippo.pappo" />
<meta property="og:image" content="http://static01.nyt.com/images/2015/02/19/arts/international/19iht-btnumbers19A/the_image_you_like.jpg" />
deny from all
allow from YOUR_IP_ADDRESS
Python, Perl and PHP open source HTML parsers. Useful for HTML traversing, parsing and scraping.
@salvatorecapolupo
salvatorecapolupo / gist:5c23e37800ee2d529bf222c504f60eaa
Created November 25, 2018 16:05
Bookmark principali siti sportivi
Per segnalazioni e richieste di rimozione scrivere a s.capolupo@gmail.com
@salvatorecapolupo
salvatorecapolupo / Software free per la fatturazione
Last active November 8, 2018 12:05
Un elenco di soluzioni web per la fatturazione, pratici e veloci.
Cosa trovate in rete di free o open source per quello che riguarda la fatturazione, fatturazione inversa, scorporo dell'IVA e calcolo delle fatture da lordo, netto ed imponibile.
@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>
@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
# 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