Skip to content

Instantly share code, notes, and snippets.

View kikegarcia's full-sized avatar

Enrique J. García kikegarcia

View GitHub Profile
@kikegarcia
kikegarcia / httpd-vhosts.conf
Created May 21, 2014 07:42
vhosts for symfony2 & xampp
# Asegúrate de tener sólo una vez esta línea en su configuración
NameVirtualHost *:80
<VirtualHost *:80>
ServerName s2.localhost
DocumentRoot "c:\xampp\htdocs\Symfony\web"
DirectoryIndex index.php
<Directory "c:\xampp\htdocs\Symfony\web">
@kikegarcia
kikegarcia / arrows_cells.js
Created May 7, 2014 08:39
Arrow keys moves between inputs inside cells
<script type="text/javascript">
$(document).ready(function () {
$('td input').each(function(index, el) {
if(!$(this).parent('td').hasClass('findesemana')) {
$(this).focus();
return false;
}
});
@kikegarcia
kikegarcia / gist:11170571
Created April 22, 2014 08:46
Get URL parameters by name
function getParameterByName(name) {
return decodeURIComponent((new
RegExp('[?|&]' + name + '=' +
'([^&;]+?)(&|#|;|$)').exec
(location.search)||[,""])
[1].replace(/\+/g, '%20'))||
null;
}
@kikegarcia
kikegarcia / forbid_copy_paste.js
Last active August 29, 2015 13:56
forbid copy paste into a form
<script type="text/javascript">
(function () {
var onload = window.onload;
window.onload = function () {
if (typeof onload == "function") {
onload.apply(this, arguments);
}
@kikegarcia
kikegarcia / timestamp_european.js
Last active August 29, 2015 13:55
Php Timestamp to European format Jquery recursive
$("span.recortar_fecha").each(function(index, el) {
var nueva_fecha = $(this).text();
var nueva_fecha_recortada = nueva_fecha.slice(0, - 9);
var trozos_fecha = nueva_fecha_recortada.split("-");
var fecha_final = trozos_fecha[2]+"-"+trozos_fecha[1]+"-"+trozos_fecha[0];
$(this).text(fecha_final);
});
@kikegarcia
kikegarcia / utf8decoder.js
Created January 16, 2014 17:42
utf8 decoder
function jutf8_decode (str_data) {
// http://kevin.vanzonneveld.net
// + original by: Webtoolkit.info (http://www.webtoolkit.info/)
// + input by: Aman Gupta
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + improved by: Norman "zEh" Fuchs
// + bugfixed by: hitwork
// + bugfixed by: Onno Marsman
// + input by: Brett Zamir (http://brett-zamir.me)
// + bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
@kikegarcia
kikegarcia / confirmbeforeleave.js
Last active January 3, 2016 05:29
Confirm if you want to leave without saving the info
$(document).ready(function() {
formmodified=0;
$('form *').change(function(){
formmodified=1;
});
window.onbeforeunload = confirmExit;
function confirmExit() {
if (formmodified == 1) {
return "No has guardado la información. ¿Estás seguro de que quieres salir?";
}
@kikegarcia
kikegarcia / header.tpl
Created December 13, 2013 12:07
removing shop title from home or other pages - Prestashop
{assign var=shop_name_to_trim value=" - $shop_name"}
<title>{$meta_title|replace:$shop_name_to_trim:''|escape:'htmlall':'UTF-8'}</title>
@kikegarcia
kikegarcia / header.tpl
Created December 13, 2013 12:06
Custom robots for CMS or other pages Prestashop
{if $page_name == 'cms' or $page_name == 'category'}
<meta name="robots" content="noindex,nofollow,noarchive,nocache">
{else}
<meta name="robots" content="{if isset($nobots)}no{/if}index,{if isset($nofollow) && $nofollow}no{/if}follow" />
{/if}
@kikegarcia
kikegarcia / getselectoption.js
Last active December 28, 2015 18:29
Gets value and uses it in a Select Option as default
<script>
function getval(sel) {
$('#stars').val(sel.value);
}
$(document).ready(function() {
var valorestrella = $('#stars').val()-1;
$('#starsrating option:eq('+valorestrella+')').prop('selected', true);
$(".center_box_content").css("background-color","#47494c");