Skip to content

Instantly share code, notes, and snippets.

View carcam's full-sized avatar

Carlos (carcam) carcam

View GitHub Profile
[color]
status = auto
diff = auto
branch = auto
interactive = auto
ui = true
[alias]
amend = !"git commit --amend -C HEAD"
st = status
ci = commit
@carcam
carcam / gist:83456db4ec495dccafb9
Last active August 29, 2015 14:17
TESTING REGEXP for closing html tags
<?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);
@carcam
carcam / gist:4d50e287873730125df1
Created May 1, 2015 23:02
Bootstrap 3 same column height
//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:51e076db9c1b6f9843c1
Last active August 29, 2015 14:20
Load images correctly in multilingual for Joomla
# 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:8cc32389a181d2c40ef7
Created May 20, 2015 09:10
Get Joomgouts MP3
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
#!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 / htaccess-optimizado.txt
Last active June 21, 2017 11:54
htaccess optimizado
### ===========================================================================
### 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
@carcam
carcam / getApplePodcastReviews.php
Last active August 5, 2017 08:35
Get itunes reviews for podcasts
<?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 / default_form.php
Last active August 16, 2017 12:14
Override to add privacy policy checkbox to com_contact
<?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;
#!sh
# Filename: RestoreBackups.sh
# Description: This Shell script helps you restore multiple Joomla! site backups created with Akeeba Backup
# Author: Carlos Camara www.cmcamara.com
# License: GPL v2.0 or later
#################
# Configuration #
#################
#