Skip to content

Instantly share code, notes, and snippets.

View fjaguero's full-sized avatar
🏠
Working from home

Fernando Agüero fjaguero

🏠
Working from home
View GitHub Profile
@fjaguero
fjaguero / smarty-prestashop-feature.tpl
Created December 18, 2012 17:05
Smarty - Prestashop: Show specific product feature
{foreach from=$features item=feature}
{if $feature.id_feature = 1}
<tr>
<td>{$feature.value|escape:'htmlall':'UTF-8'}</td>
<td>{$feature.id|escape:'htmlall':'UTF-8'}</td>
</tr>
{/if}
{/foreach}
@fjaguero
fjaguero / responsive.css
Created January 25, 2013 15:55
Basic responsive
@media only screen and (min-width: 320px) and (max-width: 480px) {
* {
-webkit-box-sizing: border-box;
/* Safari/Chrome, other WebKit */
-moz-box-sizing: border-box;
/* Firefox, other Gecko */
box-sizing: border-box;
/* Opera/IE 8+ */ }
img {
@fjaguero
fjaguero / hack.sh
Created February 6, 2013 11:14 — forked from skozz/hack.sh
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@fjaguero
fjaguero / jqueryvalidate-dni.js
Created February 13, 2013 10:14
JS: jQuery Validate - Validate DNI
jQuery.validator.addMethod("DNI", function(value, element) {
var cadenadni="TRWAGMYFPDXBNJZSQVHLCKET";
var let = value.substr(value.length-1,1);
if(/^([0-9]{8})*[a-zA-Z]+$/.test(value)){
var numero = value.substr(0,value.length-1) % 23;
letra=cadenadni.substring(numero,numero+1);
if (letra==let)
return true;
return false;
} else if (/^[XYZ]{1}/.test(value)) {
@fjaguero
fjaguero / svg-responsive.html
Last active December 13, 2015 16:58
HTML: SVG responsive images
<object data="http://www.website.com/responsive/img/logo.svg" type="image/svg+xml" class="logo">
<!--[if lte IE 8 ]-->
<img src="http://www.website.com/responsive/img/logo.gif" alt="Image Title">
<!--![endif]-->
</object>
<!-- Edit .svg file and erase width and height properties so it can automatically scale with viewport -->
<!--
CSS:
img, object {
@fjaguero
fjaguero / prestashop-aritmetic-var.tpl
Last active December 13, 2015 17:39
Smarty: Simple Prestashop aritmetic operation with variables
{if $feature.id_feature == 16 }
{assign var="shopPrice" value="`$feature.value`"}
{/if}
{if isset($shopPrice)}
<div class="tienda-discount">
{if $feature.id_feature == 16 }
{assign var="shopPrice" value="`$feature.value`"}
@fjaguero
fjaguero / sql-replace-like.sql
Created February 18, 2013 12:31
SQL: Replace a string inside a string with LIKE.
UPDATE ps_product_lang
SET ps_product_lang.description
= REPLACE(ps_product_lang.description,'http://server/demo/img/','http://server/img/')
WHERE ps_product_lang.description like '%http://server/demo/img/%';
@fjaguero
fjaguero / sql-prestashop-products.sql
Created February 26, 2013 10:21
Prestashop: SQL All Products
SELECT p.id_product, p.active, pl.name, GROUP_CONCAT(DISTINCT(cl.name) SEPARATOR ",") as categories, p.price, p.id_tax_rules_group, p.wholesale_price, p.reference, p.supplier_reference, p.id_supplier, p.id_manufacturer, p.upc, p.ecotax, p.weight, p.quantity, pl.description_short, pl.description, pl.meta_title, pl.meta_keywords, pl.meta_description, pl.link_rewrite, pl.available_now, pl.available_later, p.available_for_order, p.date_add, p.show_price, p.online_only, p.condition, p.id_shop_default
FROM ps_product p
LEFT JOIN ps_product_lang pl ON (p.id_product = pl.id_product)
LEFT JOIN ps_category_product cp ON (p.id_product = cp.id_product)
LEFT JOIN ps_category_lang cl ON (cp.id_category = cl.id_category)
LEFT JOIN ps_category c ON (cp.id_category = c.id_category)
LEFT JOIN ps_product_tag pt ON (p.id_product = pt.id_product)
WHERE pl.id_lang = 1
AND cl.id_lang = 1
AND p.id_shop_default = 1
@fjaguero
fjaguero / complete-css-queries.css
Created February 27, 2013 09:36
CSS: Complete Media Queries
/*
===================================== DESKTOP, LARGE SCREENS ====
*/
@media only screen and (min-width: 1200px) {
}
/*
@fjaguero
fjaguero / wp-list-current-category.php
Created February 28, 2013 11:01
Wordpress: wp_list_categories -> Generate the current-cat class when viewing single posts.
/* @Workether ------------------------------------------------------------
Generate the current-cat class when viewing single posts.
--------------------------------------------------------------------------*/
class singlePostCurrentCat {
function wp_list_categories ($text) {
global $post;
$categories = wp_get_post_categories($post->ID);
foreach ($categories as $category_id) {
$category = get_category($category_id);
$text = preg_replace(