Skip to content

Instantly share code, notes, and snippets.

View vladocar's full-sized avatar

Vladimir Carrer vladocar

View GitHub Profile
@vladocar
vladocar / gist:986000
Created May 22, 2011 23:28
Event Delegate 2
function delegate(selectorParent, selectorChild, type, fn) {
var i = selectorParent.length;
while (i--) {
selectorParent[i].addEventListener(type, function (e) {
if ((selectorChild.indexOf(e.target)) >= 0) {
console.log("This", e.type, " was clicked!");
@vladocar
vladocar / gist:985999
Created May 22, 2011 23:27
Event Delegate 1
document.getElementById("main").addEventListener("click", function (e) {
if ($("ul>li>a,#paragraph>a").indexOf(e.target) >= 0) {
console.log("Clicked!");
alert("Clicked!");
}
}, false);
@vladocar
vladocar / ID-Style
Created May 31, 2011 00:13
ID Style
#main { margin:0 auto; width:900px;}
#header{
float:left;
width:900px;
}
#footer{
float:left;
width:900px;
@vladocar
vladocar / ID-Style-HTML
Created May 31, 2011 00:16
ID Style HTML
<div id="main">
<div id="header">#header</div>
<div id="navigation">#navigation</div>
<div id="content">#content</div>
<div id="sidebar">#sidebar</div>
@vladocar
vladocar / modern-css-class
Created May 31, 2011 00:20
Modern CSS class
#main { margin:0 auto; width:900px;}
.w150,.w600,.w900 {float:left;}
.w900 {width:900px;}
.w600 {width:600px;}
.w150 {width:150px;}
@vladocar
vladocar / modern-css-class-html
Created May 31, 2011 00:24
Modern CSS class HTML
<div id="main">
<div id="header" class="w900"> </div>
<div id="navigation" class="w150"> </div>
<div id="content" class="w600"> </div>
<div id="sidebar" class="w150"> </div>
@vladocar
vladocar / css-framework
Created May 31, 2011 00:30
CSS Framework
/* w for width */
.w150, .w300, .w450, .w600, .w750, .w900 {float:left;}
.w150{width:150px}
.w300{width:300px}
.w450{width:450px}
.w600{width:600px}
.w750{width:750px}
.w900{width:900px}
@vladocar
vladocar / extendAll
Created June 21, 2011 00:13
Multi extend object All
function extendAll() {
var i = arguments.length;
function F() {}
function N() {}
while (i--) {
@vladocar
vladocar / extend
Created June 21, 2011 00:10
Multi extend object
function extend() {
var i = arguments.length;
function F() {}
while (i--) {
for (var m in arguments[i]) {
F.prototype[m] = arguments[i][m];
@vladocar
vladocar / picoCSS
Created June 21, 2011 00:23
picoCSS Framework and Multi extend pattern
var selector = {
select: function (selector) {
this.value = Array.prototype.slice.call(document.querySelectorAll(selector));
return this;
}
};
var loop = {
each: [].forEach,