Skip to content

Instantly share code, notes, and snippets.

@moroya
Last active December 27, 2015 11:19
Show Gist options
  • Save moroya/7318127 to your computer and use it in GitHub Desktop.
Save moroya/7318127 to your computer and use it in GitHub Desktop.
「オケオケオッケー」の中からランダムに文字列を返して、130回以内に「オケオケオッケー」に一致する文字列が出たら[それまでの試行結果]+"\n"+n+"回目の試行で成功" 出なかったら[それまでの試行結果]+"\nFailed" とツイートするクソコード
javascript:c='オケオケオッケー';l=130;r='';p=c.split('');for(i=0;i<l;i++){r+=p[~~(Math.random()*p.length)];if(r.substr(p.length*-1)==c)break;}l==i?r+='\nFailed':r+='\n'+(i+1)+'回目の試行で成功';location.href='https://twitter.com/intent/tweet?text='+encodeURIComponent(r);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment