Skip to content

Instantly share code, notes, and snippets.

View addyosmani's full-sized avatar
🎯
Focusing

Addy Osmani addyosmani

🎯
Focusing
View GitHub Profile
@jitter
jitter / gist:703467
Created November 17, 2010 15:01
Links to change on jquery.com

A - [jquery.com][1] site-wide:

  • Link for "Bug Tracker" in header (secondary) and footer navigation from http://dev.jquery.com/ to http://bugs.jquery.com

B - [jquery.com Startpage][2]

  • Linktext from "Source code/SVN" to "Source code/GIT"
  • Link for "Submit a New Bug Report" from http://dev.jquery.com/newticket/ to http://bugs.jquery.com/newticket

C - [Downloading_jQuery][3]

jQuery API.xml issues:

  • for replaceAll, :gt, :contains and :has
    the <argument> tag appears outside <signature>
  • for ajaxSuccess and ajaxSend
    the main <desc> appears inside <signature> (it should be a direct child of <entry>)

Due to these issues, some info on main api.jquery.com pages for these methods is missing.

@cowboy
cowboy / jquery.ba-nodetype.js
Created November 18, 2010 20:24
jQuery nodetype filter: Filter the selected elements by nodeType
/*!
* jQuery nodetype filter - v0.1pre - 11/18/2010
* http://benalman.com/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
(function($){
(function($){
$.Class = function(code){
var klass = function() {
var instance = (arguments[0] !== null && this.__init__ && typeof this.__init__ == 'function') ? this.__init__.apply(this, arguments) : this;
return instance;
};
$.extend(klass, this);
$.extend(klass.prototype, {
'bind': function(type, fn) {
this.__events__ = this.__events__ || {};
@remy
remy / gist:726930
Created December 3, 2010 13:08
Quick sessionStorage polyfill
if (!sessionStorage && JSON) {
sessionStorage = (function () {
var data = window.name ? JSON.parse(window.name) : {};
return {
clear: function () {
data = {};
window.name = '';
},
getItem: function (key) {
@paulirish
paulirish / gist:747835
Created December 19, 2010 23:37
`x || (x = y)` pattern for using an incoming value otherwise using some default
// from https://twitter.com/#!/LeaVerou/status/16613276313980929
// this pattern below is common for using an incoming value otherwise using some default.
/* Bad: */ x = x ? x : y; // simple ternary.
// if x is truthy lets use it.
/* Better: */ x = x || y; // logical OR.
// you could string a bunch of these easily to grab the first non-falsy value:
var application = {
page_loaded : false,
page_init : function() {
var i;
application.page_loaded = true;
// Load scripts that have not already been loaded.
var script;
for (i=0; script = application.scripts_to_load[i]; i++) {
@jeresig
jeresig / release.sh
Created January 24, 2011 22:09
Push a new jQuery release up to the CDN.
#!/bin/tcsh
# Create a new jQuery Relase
# Run like so:
# ./release.sh VERSION
# By John Resig
git pull
echo -n $1 > version.txt
git add version.txt
@rwaldron
rwaldron / array-comprehension.html
Created January 30, 2011 20:49
Various pre-Harmony bits and pieces
<script type="application/javascript;version=1.8">
var toString = Object.prototype.toString;
console.log(
[ i for each ( i in [ 1,2,3,4,5 ] ) ]
);
// A RequireJS module that wraps the jQuery UI Dialog in a jQuery.Deferred
// Advantages:
// Reuses a single DOM element for all the dialogs
// Keeps the dialog out of the DOM when it is not in use
// A much more elegant interface for using custom modals and working with the user's resolution
define("bocoup.confirm",["jquery.ui.widget"],function(factory,position,dialog) {
var d = $("<div>"),
defaults = {
title:"Confirmation"