Skip to content

Instantly share code, notes, and snippets.

@cbanowsky
Created May 15, 2015 00:34
Show Gist options
  • Save cbanowsky/4b702076b274240e2eab to your computer and use it in GitHub Desktop.
Save cbanowsky/4b702076b274240e2eab to your computer and use it in GitHub Desktop.
Implemented this variation in a project today, and it was interesting
createCode: function (amount, currency, password) {
var deferred = $q.defer();
var self = this;
var id = "";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
for( var i=0; i < 8; i++ )
id += possible.charAt(Math.floor(Math.random() * possible.length));
if (!password || password == '')
password = id;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment