Skip to content

Instantly share code, notes, and snippets.

View roden0's full-sized avatar
🎯
Focusing

Rodrigo Encinas roden0

🎯
Focusing
  • Barcelona
View GitHub Profile
@roden0
roden0 / common.js
Last active December 16, 2015 09:19
common js functions. Based on: www.dustindiaz.com
function addEvent(elm, evType, fn, useCapture) {
if (elm.addEventListener) {
elm.addEventListener(evType, fn, useCapture);
return true;
}
@roden0
roden0 / objects.js
Created April 18, 2013 12:39
JS object template. Author www.dustindiaz.com
//SAMPLE OBJECT NOTATION
var obj = {
// string
a : 'sampleValue',
// array
b : [obj1,obj2,'three',4,obj5],
@roden0
roden0 / elements.less
Last active December 16, 2015 09:19
A set of useful LESS mixins. Based on: http://lesselements.com
.gradient(@color: #F5F5F5, @start: #EEE, @stop: #FFF) {
background: @color;
background: -webkit-gradient(linear,
left bottom,
left top,
color-stop(0, @start),
color-stop(1, @stop));
background: -ms-linear-gradient(bottom,
@start,
@stop);
@roden0
roden0 / reset.less
Created April 18, 2013 12:43
HTML5 LessCSS Reset. Based on Eric Meyer's CSS Reset and html5doctor.com HTML5 Reset.
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, i, center, dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, audio, canvas, details, figcaption,
figure, footer, header, hgroup, mark, menu, meter, nav,
@roden0
roden0 / email.html
Last active December 16, 2015 09:19
HTML email boilerplate. http://www.emailonacid.com/
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Your Message Subject or Title</title>
<style type="text/css">
.ExternalClass {width:100%;}
.ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {
line-height: 100%;}
@roden0
roden0 / grid.less
Created April 18, 2013 13:08
LessGrid. Author Josh Johnson.
@columnWidth: 60px;
@gutter: 8px;
@allColumns: @columnWidth * 12;
@allGutters: (@gutter * 12) * 2;
@totalWidth: @allColumns + @allGutters;
.theWidth (@theColumn: 1, @theGutter: 0) {
width: (@columnWidth * @theColumn) + (@gutter * @theGutter);
}
@roden0
roden0 / theme.less
Created April 19, 2013 07:22
Less Color Theming Mixin.
.colorDefs(@c1: #222, @c2: #fff) {
@colorOne: @c1;
@colorTwo: @c2;
@darkGradientStart: lighten(@colorOne, 10%);
@darkGradientStop: lighten(@colorOne, 5%);
@lightGradientStart: @colorTwo;
@lightGradientStop: darken(@colorTwo, 7%);
}
.theme-blue {
@roden0
roden0 / lf4.html
Last active December 16, 2015 10:19
Less framework 4
<!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">
@roden0
roden0 / browser.js
Created April 24, 2013 14:53
browser detect by Quirksmode // http://www.quirksmode.org/js/detect.html
var BrowserDetect={init:function(){this.browser=this.searchString(this.dataBrowser)||"An unknown browser";this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"an unknown version";this.OS=this.searchString(this.dataOS)||"an unknown OS"},searchString:function(e){for(var t=0;t<e.length;t++){var n=e[t].string;var r=e[t].prop;this.versionSearchString=e[t].versionSearch||e[t].identity;if(n){if(n.indexOf(e[t].subString)!=-1)return e[t].identity}else if(r)return e[t].identity}},searchVersion:function(e){var t=e.indexOf(this.versionSearchString);if(t==-1)return;return parseFloat(e.substring(t+this.versionSearchString.length+1))},dataBrowser:[{string:navigator.userAgent,subString:"Chrome",identity:"Chrome"},{string:navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:navigator.vendor,subString:"Apple",identity:"Safari",versionSearch:"Version"},{prop:window.opera,identity:"Opera",versionSearch:"Version"},{string:navigator.vendor,subStrin
@roden0
roden0 / hiresimg.js
Created April 29, 2013 14:35
High resolution image alternate
if (window.devicePixelRatio > 1) {
var lowresImages = $('img');
images.each(function(i) {
var lowres = $(this).attr('src');
var highres = lowres.replace(".", "@2x.");
$(this).attr('src', highres);
});
}