Skip to content

Instantly share code, notes, and snippets.

Created September 9, 2013 21:22
Show Gist options
  • Save anonymous/6501698 to your computer and use it in GitHub Desktop.
Save anonymous/6501698 to your computer and use it in GitHub Desktop.
A Pen by A Non Ymous.
<canvas id="cc" style="display:none"></canvas><img id="imag">
var cc = $('#cc').get(0).getContext('2d'),img=$('img#imag');
function captcha()
{
var text = "";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for( var i=0; i < 5; i++ )
text += possible.charAt(Math.floor(Math.random() * possible.length));
return text;
}
cc.beginPath();
Math.min(parseInt(Math.random()*100))
cc.moveTo(Math.min(parseInt(Math.random()*100)),Math.max(parseInt(Math.random()*100)));
cc.lineTo(Math.min(parseInt(Math.random()*100)),Math.max(parseInt(Math.random()*100)))
cc.moveTo(Math.min(parseInt(Math.random()*100)),Math.max(parseInt(Math.random()*100)));
cc.lineTo(Math.min(parseInt(Math.random()*100)),Math.max(parseInt(Math.random()*100)))
cc.moveTo(Math.min(parseInt(Math.random()*100)),Math.max(parseInt(Math.random()*100)));
cc.lineTo(Math.min(parseInt(Math.random()*100)),Math.max(parseInt(Math.random()*100)))
Math.min(parseInt(Math.random()*100))
cc.moveTo(Math.min(parseInt(Math.random()*100)),Math.max(parseInt(Math.random()*100)));
cc.lineTo(Math.min(parseInt(Math.random()*100)),Math.max(parseInt(Math.random()*100)))
cc.moveTo(Math.min(parseInt(Math.random()*100)),Math.max(parseInt(Math.random()*100)));
cc.lineTo(Math.min(parseInt(Math.random()*100)),Math.max(parseInt(Math.random()*100)))
cc.moveTo(Math.min(parseInt(Math.random()*100)),Math.max(parseInt(Math.random()*100)));
cc.lineTo(Math.min(parseInt(Math.random()*100)),Math.max(parseInt(Math.random()*100)))
Math.min(parseInt(Math.random()*100))
cc.moveTo(Math.min(parseInt(Math.random()*100)),Math.max(parseInt(Math.random()*100)));
cc.lineTo(Math.min(parseInt(Math.random()*100)),Math.max(parseInt(Math.random()*100)))
cc.moveTo(Math.min(parseInt(Math.random()*100)),Math.max(parseInt(Math.random()*100)));
cc.lineTo(Math.min(parseInt(Math.random()*100)),Math.max(parseInt(Math.random()*100)))
cc.moveTo(Math.min(parseInt(Math.random()*100)),Math.max(parseInt(Math.random()*100)));
cc.lineTo(Math.min(parseInt(Math.random()*100)),Math.max(parseInt(Math.random()*100)))
Math.min(parseInt(Math.random()*100))
cc.moveTo(Math.min(parseInt(Math.random()*100)),Math.max(parseInt(Math.random()*100)));
cc.lineTo(Math.min(parseInt(Math.random()*100)),Math.max(parseInt(Math.random()*100)))
cc.moveTo(Math.min(parseInt(Math.random()*100)),Math.max(parseInt(Math.random()*100)));
cc.lineTo(Math.min(parseInt(Math.random()*100)),Math.max(parseInt(Math.random()*100)))
cc.moveTo(Math.min(parseInt(Math.random()*100)),Math.max(parseInt(Math.random()*100)));
cc.lineTo(Math.min(parseInt(Math.random()*100)),Math.max(parseInt(Math.random()*100)))
cc.stroke()
var pulaae=captcha();
cc.font = "40px Segoe UI"
cc.fillText(pulaae,10,50);
img.attr('src',cc.canvas.toDataURL())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment