Skip to content

Instantly share code, notes, and snippets.

View tekwiz's full-sized avatar

Travis D. Warlick, Jr. tekwiz

View GitHub Profile
@tekwiz
tekwiz / strToCodes.coffee
Last active August 29, 2015 14:01 — forked from anonymous/strToCodes.coffee
strToCodes
strToCodes = (str) ->
result = new Array(str.length)
pos = 0
while pos < str.length
c = str.charCodeAt(pos).toString(16)
result[pos] = if c.length % 2 == 1 then "x0"+c else "x"+c
result[pos] += "\n" if c == "a" # i.e. "\n"
pos++
result.join(' ')