// jQuery
$(document).ready(function() {
// code
})
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>simple minimal calculator · CodePen</title> | |
<!-- | |
Copyright (c) 2012 Sultan Tarimo, http://codepen.io/sultantarimo | |
Permission is hereby granted, free of charge, to any person obtaining |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.ajaxPagination = function(el, container, e){ | |
e.preventDefault(); | |
var oldLink, newLink, selectors, page; | |
el = $(el); | |
selectors = { | |
loading: "loading", | |
pageName: "data-page-name", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Grid | |
* | |
* useage: | |
// 25% vs 75% | |
<div class="grid-row"> | |
<div class="grid-span-1/4"></div> | |
<div class="grid-span-3/4"></div> | |
</div> |
This is now an actual repo:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Simple Pub/Sub Implementation for jQuery | |
* | |
* Inspired by work from Peter Higgins (https://github.com/phiggins42/bloody-jquery-plugins/blob/master/pubsub.js) | |
* | |
* This is about the simplest way to write a pubsub JavaScript implementation for use with jQuery. | |
*/ | |
(function( $ ) { | |
// Cache of all topics |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// model | |
function Model () { | |
this._state = {} | |
return this | |
} | |
Model.prototype.get = function (key) { | |
return this._state[key] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** @param {Node|HTMLElement} node */ | |
function toJSON(node) { | |
if(!node) | |
node = this; | |
var obj = { nodeType: node.nodeType }; | |
if(node.tagName) | |
obj.tagName = node.tagName.toLowerCase(); | |
else if(node.nodeName) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function memory(obj) { | |
var bytes = 0; | |
function size (obj) { | |
if (obj !== null && obj !== undefined) { | |
switch (typeof obj) { | |
case 'number': bytes += 8; break; | |
case 'string': bytes += obj.length * 2; break; | |
case 'boolean': bytes += 4; break; | |
case 'object': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
requestAnimationFrame(function () { | |
setTimeout(function () { | |
fn() | |
}, 0) | |
}) |
OlderNewer