Skip to content

Instantly share code, notes, and snippets.

Avatar

Carlos (carcam) carcam

View GitHub Profile
@carcam
carcam / ps_googleanalytics.tpl
Last active Dec 1, 2020
Override del módulo oficial de Analytics de PrestaShop 1.7 para usarlo sin cookies (Cookieless Analytics)
View ps_googleanalytics.tpl
{**
* 2014-2020 Hepta Technologies SL
*
* INSTRUCCIONES:
*
* ESTE OVERRIDE SÓLO FUNCIONA PARA LA VERSIÓN 1.7 DE PRESTASHOP Y USANDO EL MÓDULO OFICIAL DE GOOGLE ANALYTICS
*
* Una vez configurado el módulo, sube este fichero a:
*
* /themes/[CARPETA DE TU TEMA]/modules/ps_googleanalytics/views/templates/hook/ps_googleanalytics.tpl
@carcam
carcam / default_form.php
Last active Aug 16, 2017
Override to add privacy policy checkbox to com_contact
View default_form.php
<?php
/**
* @author Carlos Cámara
* @url https://www.hepta.es
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
@carcam
carcam / getApplePodcastReviews.php
Last active Aug 5, 2017
Get itunes reviews for podcasts
View getApplePodcastReviews.php
<?php
//Set here the Apple ID of your podcast
$iTunesId = 1241730868;
$countries =["benl","befr","bg","cz","dk","de","ee","es","fr","gr","hr","ie","it","lv","li","lt","lu","mk","hu","mt","md","me","nl","no","at","pl","pt","ro","ru","sk","si","chde","chfr","fi","se","tr","uk","lae","lae","la","lae","lae","lae","la","br","lae","lae","cl","co","la","lae","la","la","la","lae","la","lae","la","lae","mx","lae","la","la","la","la","lae","lae","lae","lae","lae","lae","lae","la","la","la","lae","ca","lae","la",];
$countries = array_unique($countries);
foreach ($countries as $country)
@carcam
carcam / htaccess-optimizado.txt
Last active Jun 21, 2017
htaccess optimizado
View htaccess-optimizado.txt
### ===========================================================================
### Security Enhanced & Highly Optimized .htaccess File for Joomla!
### automatically generated by Admin Tools 3.6.8 on 2016-01-15 22:02:05 GMT
### Auto-detected Apache version: 2.5 (best guess)
### ===========================================================================
###
### The contents of this file are based on the same author's work "Master
### .htaccess", published on http://snipt.net/nikosdion/the-master-htaccess
###
### Admin Tools is Free Software, distributed under the terms of the GNU
View SetupDevEnv.sh
#!sh
if [ $# -lt 3 ]
then
echo "USAGE: [FOLDER in htdocs] [COMPONENT NAME: com_whatever] [REPOSITORY FOLDER]"
exit
fi
SITE="$1"
COMPONENT="$2"
REPOSITORY="${3}"
@carcam
carcam / imgopt.sh
Created Dec 11, 2015
Image optimization bash script
View imgopt.sh
##
# @author Carlos Cámara <cmcamara@gmail.com> based on the script by freakie guy <freakie2007@gmail.com>
# @package Batch Optimize Image for web performance similar to Compressor.io
# @requirement jpegoptim, optipng
##
#
# Folder path
#
View gist:8cc32389a181d2c40ef7
youtube-dl --playlist-start 53 --dateafter `date -v-monday +%Y%m%d` -x --audio-format mp3 http://www.youtube.com/playlist?list=PLIcuwIrm4rKeCBZYvueddKTA4yFcHsQqZ
count=`ls -1 *.mp3 2>/dev/null | wc -l`
if [ $count != 0 ]
then
mensaje="¡Hay un nuevo programa de Joomgouts listo!"
else
mensaje="Esta semana no hay programa de Joomgouts :("
fi
#Display Apple notification: http://apple.stackexchange.com/questions/57412/how-can-i-trigger-a-notification-center-notification-from-an-applescript-or-shel
@carcam
carcam / gist:51e076db9c1b6f9843c1
Last active Aug 29, 2015
Load images correctly in multilingual for Joomla
View gist:51e076db9c1b6f9843c1
# Load images correctly in multilingual for Joomla
# This fixes when images are requested as http://www.site.com/en/images/myimage.png
# Although the best solution is to add the slash / to your images path: src="/images/myimage.png" in your content
RewriteRule ^[a-z]{2}/images/(.*) /images/$1
@carcam
carcam / gist:4d50e287873730125df1
Created May 1, 2015
Bootstrap 3 same column height
View gist:4d50e287873730125df1
//http://stackoverflow.com/questions/23287206/same-height-column-bootstrap-3-row-responsive
$( document ).ready(function() {
var heights = $(".well").map(function() {
return $(this).height();
}).get(),
maxHeight = Math.max.apply(null, heights);
$(".well").height(maxHeight);
});
@carcam
carcam / gist:83456db4ec495dccafb9
Last active Aug 29, 2015
TESTING REGEXP for closing html tags
View gist:83456db4ec495dccafb9
<?php
$mypattern = "([\w-.]+)+(:\d+)?(/([\w/_\-.]*(\?\S+)?)?)?(.*)?";
$pattern = '[a-zA-Z0-9&?_.,=%\-\/#]';
$url = "http://formaciononline.nccextremadura.org#formacion-desempleados";
$newurl = preg_replace('@(https?://'.$pattern.'*)@i', '<a href="$1">$1</a>', $url);
//echo "Old URL-> ".$url;
//echo "<br/>";
//echo "New URL -> ".htmlspecialchars($newurl);