Skip to content

Instantly share code, notes, and snippets.

@kotfic
Created March 30, 2012 21:08
Show Gist options
  • Save kotfic/2255014 to your computer and use it in GitHub Desktop.
Save kotfic/2255014 to your computer and use it in GitHub Desktop.
Duck punching for fun and profit
Backbone._sync = Backbone.sync;
Backbone.sync = function(method, model, options) {
options = _.extend( options, {
beforeSend: function(xhr) {
xhr.setRequestHeader("Authorization", "Basic " + window.btoa( localStorage['assembla_username'] + ":" + localStorage['assembla_password'] ) );
} });
return Backbone._sync( method, model, options );
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment