Skip to content

Instantly share code, notes, and snippets.

@molarmanful
Last active January 17, 2017 20:52
Show Gist options
  • Save molarmanful/7b3f54efef4141959b4c to your computer and use it in GitHub Desktop.
Save molarmanful/7b3f54efef4141959b4c to your computer and use it in GitHub Desktop.
A really small Rubik's Cube timer. Demo: http://codepen.io/molarmanful/pen/eNgLNL
<h1 id="a">0.000</h1><p id="s"></p>
function z(){for(c=b=j=25,r=Math.random,s[i='innerHTML']='';j;c+b-5|c-m&&b-m?s[i]+="URFBLD"[j--,c=b,b=m]+" 2'"[0|r()*3]+" ":0)m=0|r()*6}z(),k=onkeyup=function(x){x.which^32||k?(S=new Date,T=setInterval("a[i]=(new Date-S)/1e3")):(clearInterval(T),z());k=!k}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment