Skip to content

Instantly share code, notes, and snippets.

@carlossalas
carlossalas / index.html
Created November 13, 2012 21:21
HTML: Skeleton with Twitter Bootstrap, Less And Modernizr
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
@carlossalas
carlossalas / index.js
Created November 22, 2012 22:01
JS: Force Input Numeric Only
//Force Input Numeric Only
jQuery.fn.ForceNumericOnly = function() {return this.each(function() {$(this).keydown(function(e) {var key = e.charCode || e.keyCode || 0; return (key == 8 || key == 9 || key == 46 || (key >= 37 && key <= 40) || (key >= 48 && key <= 57) || (key >= 96 && key <= 105)); }); }); };
@carlossalas
carlossalas / index.js
Created March 11, 2013 15:55
JS: LimitMaxLength
//LimitMaxLength
jQuery.fn.limitMaxlength = function(options){var settings = jQuery.extend({attribute: "maxlength", onLimit: function(){}, onEdit: function(){} }, options); var onEdit = function(){var textarea = jQuery(this); var maxlength = parseInt(textarea.attr(settings.attribute)); if(textarea.val().length > maxlength){textarea.val(textarea.val().substr(0, maxlength)); jQuery.proxy(settings.onLimit, this)(); } jQuery.proxy(settings.onEdit, this)(maxlength - textarea.val().length); } this.each(onEdit); return this.keyup(onEdit) .keydown(onEdit) .focus(onEdit) .blur(onEdit) .on('input paste', onEdit); }
@carlossalas
carlossalas / index.html
Created March 17, 2013 06:48
HTML: Skeleton V2
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
@carlossalas
carlossalas / index.css
Created March 17, 2013 07:00
CSS: BoxSizing, IMG VerticalAlign, BODY HTML height 100%, FORM ELEMENTS Outline, Resize
/* apply a natural box layout model to all elements */
* { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; margin: 0; padding: 0; }
img { vertical-align: bottom; }
body, html
{
height: 100%;
outline: none;
}
@carlossalas
carlossalas / index.html
Created May 20, 2013 21:04
HTML: Skeleton V3
<!DOCTYPE html>
<!--[if lt IE 7 ]><html class="no-js ie ie6" lang="en"><![endif]-->
<!--[if IE 7 ]><html class="no-js ie ie7" lang="en"><![endif]-->
<!--[if IE 8 ]><html class="no-js ie ie8" lang="en"><![endif]-->
<!--[if IE 9 ]><html class="no-js ie ie9" lang="en"><![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--><html class="no-js" lang="en"><!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="description" content="">
@carlossalas
carlossalas / index.scss
Last active October 15, 2020 22:19
CSS: Compass
@import "compass";
$screen-xs: 480px;
$screen-sm: 768px;
$screen-md: 992px;
$screen-lg: 1200px;
*
{
/* apply a natural box layout model to all elements */
@carlossalas
carlossalas / log.js
Last active October 15, 2020 22:18
Console Log
// Avoid 'console' errors in browsers that lack a console.
(function() {var method; var noop = function noop() {}; var methods = ['assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', 'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd', 'timeStamp', 'trace', 'warn']; var length = methods.length; var console = (window.console = window.console || {}); while (length--) {method = methods[length]; if (!console[method]) {console[method] = noop; } } }());
//Log Function
window.log = function(){log.history = log.history || []; log.history.push(arguments); arguments.callee = arguments.callee.caller; if(this.console) console.log( Array.prototype.slice.call(arguments) ); };
@carlossalas
carlossalas / index.js
Created January 10, 2014 18:33
JS: Force Letter Only
jQuery.fn.ForceLettersOnly = function() {return this.each(function() {$(this).keydown(function(e) {var key = e.charCode || e.keyCode || 0; var letter = String.fromCharCode(key); return ((key < 48 || key > 57) && (key < 96 || key > 105) || !letter.match(/[^a-zA-Z]/g)); }); }); };
@carlossalas
carlossalas / index.html
Last active October 15, 2020 22:18
HTML: Skeleton v4
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
<!-- MOBILE SPECIFICATIONS -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">