Skip to content

Instantly share code, notes, and snippets.

View pazguille's full-sized avatar

Guille Paz pazguille

View GitHub Profile
@pazguille
pazguille / in-place.js
Created October 23, 2012 10:38
Simple and tiny in-place Editor
(function (window) {
'use strict';
var document = window.document,
console = window.console;
document.addEventListener('keydown', function (event) {
event = event || window.event;
var target = event.target || event.srcElement,
esc = (event.which === 27),
@pazguille
pazguille / analytics.html
Last active October 13, 2015 15:28
Google Analytics
<!-- Google Analytics: change UA-XXXXX-X to be your site's ID. -->
<script>
var _gaq=[['_setAccount','UA-XXXXX-X'],['_trackPageview']];
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
s.parentNode.insertBefore(g,s)}(document,'script'));
</script>
<!-- Google Analytics: Subdomains. -->
<script>
@pazguille
pazguille / gist:4494583
Last active December 10, 2015 21:18
$.each() vs for(){}
var collection = ['a','b','c','d','e'];
// Vanilla JavaScript
var i = 0,
len = collection.length;
for (; i < len; i += 1) {
console.log(collection[i]);
}
// jQuery
@pazguille
pazguille / dabblet.css
Created March 7, 2013 10:26
Textareas Resizables
textarea{ resize: none; }
@pazguille
pazguille / README.md
Last active December 15, 2015 08:38
My README.md template.
.container {
background-color: red;
height:300px;
width: 500px;
display: table;
}
.content {
background-color:blue;
display: table-cell;
@pazguille
pazguille / mobile-first.css
Last active December 17, 2015 12:29
Media queries to start a project "Mobile First".
/*! normalize.css v3.0.2 | MIT License | git.io/normalize */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;
/**
* Singleton Pattern
*/
function Singleton(options) {
if (!(this instanceof Singleton) && Singleton.getInstance === undefined) {
Singleton.getInstance = new Singleton();
return Singleton.getInstance;
}
@pazguille
pazguille / index.html
Last active April 26, 2024 08:23
Simple JavaScript Templating by John Resig
<script type="text/html" id="item_tmpl">
<div id="<%=id%>" class="<%=(i % 2 == 1 ? " even" : "")%>">
<div class="grid_1 alpha right">
<img class="righted" src="<%=profile_image_url%>"/>
</div>
<div class="grid_6 omega contents">
<p><b><a href="/<%=from_user%>"><%=from_user%></a>:</b> <%=text%></p>
</div>
</div>
</script>
@pazguille
pazguille / modular.js
Last active December 26, 2015 21:09
Modular Pattern
/*
* Component
*/
(function (win) {
'use strict';
/**
* Component definition
*/