Skip to content

Instantly share code, notes, and snippets.

View qborreda's full-sized avatar

Quique Borredá qborreda

View GitHub Profile
@qborreda
qborreda / box_model_fix.css
Created May 7, 2013 08:10
CSS Box Model Fix
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
@qborreda
qborreda / ejemplo.html
Created May 7, 2013 08:13
JavaScript LazyLoad of images http://jsfiddle.net/g8THY/6/
<img data-src="http://farm8.staticflickr.com/7060/6969705425_0905bf6bba_o.jpg" src="blank.gif" class="lazy" height="612" width="612">
@qborreda
qborreda / calculateSince.js
Created May 7, 2013 08:19
Cálculo en texto del tiempo pasado desde un datetime dado
/**
* Calculates the Twitter time since the tweet was created
* @param datetime returned by Twitter API in created_at
* @return time since in html
*/
function calculateSince(datetime)
{
var tTime=new Date(datetime);
var cTime=new Date();
var sinceMin=Math.round((cTime-tTime)/60000);
<div class="block" style="height: 300px;">
<div class="centered">
<h1>Some text</h1>
<p>But he stole up to us again, and suddenly clapping his hand on my shoulder, said&mdash;"Did ye see anything looking like men going towards that ship a while ago?"</p>
</div>
</div>
@qborreda
qborreda / ejemplo.html
Created May 7, 2013 09:07
jQuery Multi array table sortening http://jsfiddle.net/VAKrE/105/
Click on the table headings to sort the results.
<table>
<thead id="headings">
<tr>
<th id="f_name">First Name</th>
<th id="l_name">Last Name</th>
<th id="age">Age</th>
</tr>
</thead>
<tbody id="results">
@qborreda
qborreda / ejemplo.html
Created May 7, 2013 09:08
jQuery Mouse Coordinates
<span id="spnCursor"></span>
@qborreda
qborreda / normalize_strings.js
Created May 7, 2013 09:16
JavaScript Normalize strings
var normalize = (function() {
var from = "ÃÀÁÄÂÈÉËÊÌÍÏÎÒÓÖÔÙÚÜÛãàáäâèéëêìíïîòóöôùúüûÑñÇç",
to = "AAAAAEEEEIIIIOOOOUUUUaaaaaeeeeiiiioooouuuunncc",
mapping = {};
for(var i = 0, j = from.length; i < j; i++ )
mapping[ from.charAt( i ) ] = to.charAt( i );
return function( str ) {
var ret = [];
@qborreda
qborreda / ejemplo.html
Created May 7, 2013 09:18
CSS + jQuery Style Switcher
<link type="text/css" href="estilo1.css" rel="Stylesheet" id="linkestilo">
<a href="estilo2.css" class="enlaceestilo">Cambia el estilo!</a><br>
<a href="estilo3.css" class="enlaceestilo">Cambia a otro estilo!</a><br>
<a href="estilo1.css" class="enlaceestilo">Volver al estilo original</a>
@qborreda
qborreda / selector_hacks.css
Created May 7, 2013 09:20
CSS Selector Hacks
/***** Selector Hacks ******/
/* IE6 and below */
* html #uno { color: red }
/* IE7 */
*:first-child+html #dos { color: red }
/* IE7, FF, Saf, Opera */
html>body #tres { color: red }
@qborreda
qborreda / Gravity.as
Created May 7, 2013 09:22
ActionScript Gravity.as - Movimientos con aceleración
package
{
import flash.display.Sprite;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
public class Gravity extends Sprite
{
private var ball:Ball;