Skip to content

Instantly share code, notes, and snippets.

@OpenGrid
Created August 3, 2011 21:07
Show Gist options
  • Save OpenGrid/1123774 to your computer and use it in GitHub Desktop.
Save OpenGrid/1123774 to your computer and use it in GitHub Desktop.
Shortest code possible
var alfabet="abcdefghjpz679";
var convertToLetters = function(n){for(var a=alfabet,c='',l=a.length;c=a[n%l]+c,n=n/l|0,n--;);return c};
var convertToNumber = function(s,i,v){with(alfabet)for(i=v=0;s[i];v=v*length-~indexOf(s[i++]));return~-v};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment