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 / 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 / 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 / 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 / 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 / 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 / test.html
Created December 12, 2012 22:43
Form
<!doctype html>
<header> </header>
<body>
<span style="float:left;">
<label for="id1">label1:</label>
<input type="text" id="id1"/><br>
@fjaguero
fjaguero / css_tranistions_sprites.css
Created October 31, 2012 09:16
CSS - Transitions with Sprites
.icon-facebook {
background-position: -50px 0;
width: 20px;
height: 19px;
position: relative;
text-indent: -9999px;
display: inline-block;
}
.icon-facebook:after{
background: url("images/sprites/sprite-icons.png") no-repeat scroll -75px 0 transparent;
@fjaguero
fjaguero / php-facebook-wordpressLoop.php
Created October 19, 2012 16:22
PHP: Facebook like for Wordpress Loop
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=224015364350232";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
@fjaguero
fjaguero / font-face.css
Created October 19, 2012 10:34
CSS: @font-face standard css
@font-face {
font-family: 'ModernNo.20Regular';
src: url('../fonts/mod20-webfont.eot');
src: url('../fonts/mod20-webfont.eot?#iefix') format('embedded-opentype'),
url('../fonts/mod20-webfont.woff') format('woff'),
url('../fonts/mod20-webfont.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
@fjaguero
fjaguero / wp-menu-custom-title-category.php
Created October 17, 2012 12:33
PHP: Show the title of a menu element depending the current category
/* ----------------------------- FUNCTIONS.PHP --------------------------*/
/* @Workether ------------------------------------------------------------
Get Category ID by his name.
--------------------------------------------------------------------------*/
function get_category_id($cat_name){
$term = get_term_by('name', $cat_name, 'category');
return $term->term_id;
}