Skip to content

Instantly share code, notes, and snippets.

@trendsetter37
Created October 2, 2015 18:53
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 trendsetter37/f17c579ecf5e511c5b5f to your computer and use it in GitHub Desktop.
Save trendsetter37/f17c579ecf5e511c5b5f to your computer and use it in GitHub Desktop.
Getting Client IP in CoffeeScript
http.get { host: 'checkip.dyndns.org' }, (res) ->
data = ''
res.on 'data', (chunk) ->
data += chunk.toString()
res.on 'end', () ->
console.log data.match(/([0-9]+\.){3}[0-9]+/)[0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment