Skip to content

Instantly share code, notes, and snippets.

@spoike
Created September 24, 2013 13:43
Show Gist options
  • Select an option

  • Save spoike/6684909 to your computer and use it in GitHub Desktop.

Select an option

Save spoike/6684909 to your computer and use it in GitHub Desktop.
For determining which character to take from an ascii table using row and column indices.
var toAsciiIndex = function(str) {
var i, carr = [], curr;
for(i = 0; i < str.length; i++) {
curr = str.charCodeAt(i);
carr.push([curr%32, Math.floor(curr/32)]);
}
return carr;
};
toAsciiIndex("Hah"); // -> [[8,2],[1,3],[8,3]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment