Skip to content

Instantly share code, notes, and snippets.

@elegantcoder
Created September 21, 2012 05:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elegantcoder/3759894 to your computer and use it in GitHub Desktop.
Save elegantcoder/3759894 to your computer and use it in GitHub Desktop.
JS Util Functions

JS Util Functions

getNumericValue = (str) ->
str.replace(/[^-\d\.]/g, '')
makeHash = () ->
Math.random().toString(16).slice(2,10)
sanitizeStr2HTMLElementId = (hash) ->
hash.replace(/[^a-zA-Z0-9\-_:\.]/, '-')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment