This file contains hidden or 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
/** | |
* Copyright(c) 2011 Andrée Hansson | |
* @peolanha | |
* http://github.com/peol | |
* | |
* License: Do whatever you want, some attribution would be nice | |
* | |
* Small, versatile relative time function, options: | |
* asArray: Returns the data in an array, each entry has [0] = number, [1] = string representation | |
* filterValues: Removes all entries with 0 as value |
This file contains hidden or 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
/*! | |
* isVis - v0.5.5 Aug 2011 - Page Visibility API Polyfill | |
* Copyright (c) 2011 Addy Osmani | |
* Dual licensed under the MIT and GPL licenses. | |
*/ | |
(function () { | |
window.visibly = { | |
b: null, | |
q: document, |
This file contains hidden or 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
<!-- autofocus shim for older browsers that doesn't impact newer ones --> | |
<input type="text" name="q" id="q" autofocus> | |
<script> | |
(function(textbox){ | |
if (textbox.autofocus !== true){ | |
textbox.focus(); | |
} | |
})(document.getElementById("q")); | |
</script> |
This file contains hidden or 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 pxem($pxval, $base: 16px) { | |
// Function to take a pixel value and divide it by a base value in order to | |
// return the size in ems. Default base value is 16px | |
@return ($pxval / $base) * 1em; // multiply by 1em to convert px to ems. | |
} | |
body { | |
background-color: #DCDBD9; | |
color: #2C2C2C; | |
font: normal 100% Cambria, Georgia, serif; |
This file contains hidden or 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 parallel() { | |
var args = Array.apply(null, arguments) | |
, callback = args.pop() | |
, returns = [] | |
, len = 0 | |
args.forEach(function (el, i) { | |
el(function () { | |
var a = Array.apply(null, arguments) | |
, e = a.shift() | |
if (e) return callback(e) |
This file contains hidden or 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
# Asynchronous DSL for CoffeeScript | |
serial = (f) -> | |
next = -> arr.shift().apply(null, arguments) if arr.length | |
arr = (v for k, v of f(next)) | |
next() | |
null | |
parallel = (f, after = ->) -> | |
res = {}; arrc = 0 |
This file contains hidden or 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
// First, let's define a widget/plugin called "foo" | |
// Either using jQuery's $.fn plugin namespace, for simple stateless plugins... | |
$.fn.foo = function(){ | |
// In this scope, this refers to the element on which the plugin foo() was called | |
// manipulate it and return this at the end, so it can be chainable | |
}; |
This file contains hidden or 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
// (c) 2011 Thomas Fuchs | |
(function($){ | |
$.fn.delayedHover = function(){ | |
var timeout = null, hovering = false, element = this; | |
function enter(){ | |
element.trigger('delayed_hover:enter'); | |
timeout = null; | |
hovering = true; |
This file contains hidden or 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
Drop in replace functions for setTimeout() & setInterval() that | |
make use of requestAnimationFrame() for performance where available |