Skip to content

Instantly share code, notes, and snippets.

View andremedeiros's full-sized avatar
:shipit:

André Medeiros andremedeiros

:shipit:
View GitHub Profile
# Helpers
def get_file(http_location, file)
run "curl -sL #{http_location}/#{file} > #{file}"
end
def app_name
@app_name ||= @root.split('/').last
end
# Remove Prototype defaults and grab jQuery + Rails adapter
@andremedeiros
andremedeiros / jquery.mobile.page.cache.js
Created November 17, 2010 18:58
jquery.mobile.page.cache.js
(function ( $ ) {
var rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi;
$.mobile.page.prototype.options.cache = true;
$( "body" )
.delegate( ":mobile-page", "pagebeforecreate", function() {
var page = $( this ).data( "page" ),
cache = page.options.cache;
if ( cache === true ) {
return;
(function ( jQuery ) {
$( 'body' ).delegate( ".ui-page", "pagebeforeshow", function( event, opts ) {
var $page = $(event.target),
reloadPage = false,
cacheStrategy = $page.data('cache'),
pageInstance = $page.data('page'),
invalidateCache = pageInstance.dirtyCache;
// Check if page never gets cached
if ( cacheStrategy == 'never' ) {