Skip to content

Instantly share code, notes, and snippets.

@DanThiffault
Created February 28, 2011 06:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DanThiffault/847004 to your computer and use it in GitHub Desktop.
Save DanThiffault/847004 to your computer and use it in GitHub Desktop.
Bookmarklet format setup
module BookmarkletFormat
Mime::Type.register_alias "text/javascript", :bookmarklet
def infer_bookmarklet_format
if request.format == :js && request.referer.to_s.match('^' + bookmarklet_url.to_s)
request.format = :bookmarklet unless disable_bookmarklet?
end
end
def disable_bookmarklet?
false
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment