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
require 'net/http' | |
# WARNING do not use this; it works but is very limited | |
def resolve url | |
res = Net::HTTP.get_response URI(url) | |
if res.code == '301' then res['location'] | |
else url.to_s | |
end | |
end |
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
// Initialize our apps namespace; add a pages holder for later. | |
var MYAPP = { | |
pages: {} | |
}; | |
// A closure to encapsulate our HomePage class. | |
(function($, app) { | |
// This little guy is private to this closure. | |
function bindButtons($page) { |
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
// Create our namespace object, use one that already exists if it's available, fall back to new object "{}". | |
var MYAPP = MYAPP || {}; | |
(function($, ns) { | |
// .. This is a closure, so we don't muddy up our global namespace. | |
// .. $ = jQuery, ns = MYAPP (For those playing along at home) | |
// Extend our namespace with some stuff we're going to add later. | |
ns = $.extend(ns, { |
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
@mixin ie6 { * html & { @content } } | |
#logo { | |
background-image: url("/images/logo.png"); | |
@include ie6 { background-image: url("/images/logo.gif"); } | |
} |
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
// Get our transition links in the nav | |
opts.$navLinks = $('nav a[transition-link]'); | |
// Attach click handlers for all links with our special transition attribute. | |
opts.$navLinks.click(function(e) { | |
// Prevent navigation... | |
e.preventDefault(); | |
opts.toggleLoading(true); |
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
/* Author: | |
Jacob Gable, http://jacob4u2.posterous.com | |
License: | |
MS-PL | |
*/ | |
jQuery.any = function (collection, compareFunc) { | |
if (!$.isArray(collection) || !$.isFunction(compareFunc)) { | |
return false; | |
} |