Skip to content

Instantly share code, notes, and snippets.

@milancermak
milancermak / gist:3450666
Created August 24, 2012 13:44
Google Web server application OAuth flow, step 1
from oauth2client.client import OAuth2WebServerFlow
flow = OAuth2WebServerFlow(client_id="some-random-hash.apps.googleusercontent.com",
client_secret="your-client-secret",
scope="https://www.googleapis.com/auth/androidpublisher")
auth_url = flow.step1_get_authorize_url(redirect_uri="http://localhost")
/* Use this to cause a function to fire no more than once every 'ms' milliseconds.
For example, an expensive mousemove handler:
$('body').mouseover(ratelimit(function(ev) {
// ...
}, 250));
*/
function ratelimit(fn, ms) {
var last = (new Date()).getTime();