Skip to content

Instantly share code, notes, and snippets.

@ashaw
Created January 6, 2011 02:58
Show Gist options
  • Save ashaw/767434 to your computer and use it in GitHub Desktop.
Save ashaw/767434 to your computer and use it in GitHub Desktop.
def sanitize_callback(callback)
if callback.nil?
return
end
callback=~/^(.{5}?)(\d?)/
return nil if callback.length == 0
return nil if $1 != "jsonp"
return nil if $2 == ""
return nil if callback.length > 128
return callback
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment