Skip to content

Instantly share code, notes, and snippets.

@sdqali
Created September 26, 2012 13:26
Show Gist options
  • Save sdqali/3788028 to your computer and use it in GitHub Desktop.
Save sdqali/3788028 to your computer and use it in GitHub Desktop.
(require 'url)
(require 'json)
(defun ud-define (wd)
(interactive "M")
(let ((url-request-method "GET"))
(url-retrieve (concat "http://urbanscraper.herokuapp.com/define/" wd ".json")
(lambda (x)
(goto-char (point-min))
(search-forward-regexp "\{.*")
(setq word-definition (gethash "definition"
(let ((json-object-type 'hash-table))
(json-read-from-string (match-string-no-properties 0)))))))
(message word-definition)))
(ud-define "bazooka")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment