Skip to content

Instantly share code, notes, and snippets.

View addyosmani's full-sized avatar
🎯
Focusing

Addy Osmani addyosmani

🎯
Focusing
View GitHub Profile
@rwaldron
rwaldron / clone.js
Created June 5, 2011 20:30
Real, deep copied objects.
function clone( obj ) {
var val, length, i,
temp = [];
if ( Array.isArray(obj) ) {
for ( i = 0, length = obj.length; i < length; i++ ) {
// Store reference to this array item's value
val = obj[ i ];
// If array item is an object (including arrays), derive new value by cloning
@pamelafox
pamelafox / friendsearch.html
Created June 2, 2011 18:53
Facebook API + jQuery Autosuggest
<!doctype html>
<head>
<link rel="stylesheet" href="/css/style.css">
<body>
<input class="friend-search"></input>
<div id="fb-root"></div>
<script>window.jQuery || document.write("<script src='/js/libs/jquery-1.5.1.min.js'>\x3C/script>")</script>
<script src="/js/jquery.autosuggest.js"></script>
@cowboy
cowboy / unreleased.md
Created June 1, 2011 20:05
Unreleased stuff...

This list will hopefully shrink faster than it can grow. (yeah, right)

jQuery

jQuery deparam / deparam+ / sortObject (WIP)
https://gist.github.com/1025817

jQuery infiniteScroller (WIP)

jQuery scrollinout event

@jed
jed / LICENSE.txt
Created May 29, 2011 10:03 — forked from 140bytes/LICENSE.txt
polyfill requestAnimationFrame across browsers
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
(function( jQuery ) {
var getScript = jQuery.getScript;
jQuery.getScript = function( resources, callback ) {
var // reference declaration & localization
length = resources.length,
handler = function() { counter++; },
deferreds = [],
@christoomey
christoomey / gist:965669
Created May 11, 2011 00:23
Javascript object literal code organization pattern
// Object literal code organization pattern. From Rebecca Murphy's blog:
// http://blog.rebeccamurphey.com/2009/10/15/using-objects-to-organize-your-code
var myModule = {
'config' : {
'option1' = val,
'cached_elem' = $(this)
},
'init' : function(config) {
// provide for custom configuration via init()
@aral
aral / gist:965632
Created May 10, 2011 23:48
Orientation change doesn't fire on iPad - workaround - jQueryMobile scrollView
/*$(document).live("orientationchange", function(event) {
ResizePageContentHeight($(".ui-page"));
});*/
// As per: http://code.google.com/p/jqtouch/issues/detail?id=370
$(window).bind('orientationchange', function(event) {
ResizePageContentHeight($(".ui-page"));
}).trigger('orientationchange');
@jed
jed / LICENSE.txt
Created May 10, 2011 16:04 — forked from 140bytes/LICENSE.txt
write contextual templates
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@jed
jed / LICENSE.txt
Created May 10, 2011 14:44 — forked from 140bytes/LICENSE.txt
route client urls with 404s and pattern captures
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@blackfalcon
blackfalcon / complies.css
Created May 6, 2011 19:25
A pure CSS3 tooltip
.axle_tooltip {
width: 200px;
height: auto;
padding: 10px 40px 20px 20px;
background: rgba(28, 29, 31, 0.6);
background: -moz-linear-gradient(top, rgba(28, 29, 31, 0.6) 0%, #1c1d1f 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, rgba(28, 29, 31, 0.6)), color-stop(100%, #1c1d1f));
background: -webkit-linear-gradient(top, rgba(28, 29, 31, 0.6) 0%, #1c1d1f 100%);
background-image: -o-linear-gradient(top, rgba(28, 29, 31, 0.6) 0%, #1c1d1f 100%);
border: 2px solid white;