This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defmacro test (query &rest args) | |
| `(let ((query-args | |
| (mapcar | |
| (lambda (x) | |
| (coerce (symbol-name x) 'string)) | |
| (quote ,args)))) | |
| query-args)) | |
| (test 'select item.condition.temp weather.forecast location=30332) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Debugger entered--Lisp error: (wrong-type-argument sequencep item\.condition\.temp) | |
| coerce(item\.condition\.temp string) | |
| (lambda (x) (coerce x (quote string)))(item\.condition\.temp) | |
| mapcar((lambda (x) (coerce x (quote string))) (item\.condition\.temp weather\.forecast location=30332)) | |
| (let ((query-args ...)) query-args) | |
| (test (quote select) item\.condition\.temp weather\.forecast location=30332) | |
| eval((test (quote select) item\.condition\.temp weather\.forecast location=30332)) | |
| eval-last-sexp-1(t) | |
| eval-last-sexp(t) | |
| eval-print-last-sexp() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defun yql-fetch-latest-tweet (user) | |
| (interactive "sWhich user?: ") | |
| (let* ((result | |
| (yql-filter | |
| 'item | |
| (yql-select | |
| "title,pubDate" "rss" | |
| (format "url='http://twitter.com/statuses/user_timeline/%s.rss' LIMIT 1" user)))) | |
| (tweet-time |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (let ((results (yql 'filter | |
| 'item | |
| (yql 'select | |
| "title,pubDate" "rss" | |
| "url='http://twitter.com/statuses/user_timeline/wfarr.rss' LIMIT 1")))) | |
| (print (yql 'filter 'title results)) | |
| (print (yql 'filter 'pubDate results))) | |
| ;; Prints: | |
| ;; "wfarr: @20seven @joshjgt and I are working on our Yahoo Hack Week project, by creating an elisp library for it! http://tinyurl.com/c2eddc" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defun yql-yahoo-search (query) | |
| (let ((result (yql-filter 'result | |
| (yql-select "title,abstract,url" "search.web" | |
| (concat (format "query=\"%s\"" query) | |
| "LIMIT 5"))))) | |
| (save-excursion | |
| (set-buffer (get-buffer-create "*Search Results*")) | |
| (dolist (item result) | |
| (let ((title (yql-filter 'title item)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; Ran: (yql-make-request "select content from flickr.places where query=\"north beach\" limit 1") | |
| ((query | |
| (results | |
| (place . "North Beach, San Francisco, CA, United States")) | |
| (diagnostics | |
| (build-version . "911") | |
| (service-time . "125") | |
| (user-time . "128") | |
| (url ... ...) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; Ran: (yql-make-request "select place_url from flickr.places where query=\"north beach\" limit 1") | |
| ((query | |
| (results | |
| (place | |
| (place_url . "/United+States/California/San+Francisco/North+Beach"))) | |
| (diagnostics (build-version . "911") | |
| (service-time . "152") | |
| (user-time . "158") | |
| (url |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; Ran: (yql-make-request "select * from flickr.places where query=\"north beach\" limit 1") | |
| ((query | |
| (results | |
| (place | |
| (content . "North Beach, San Francisco, CA, United States") | |
| (woeid . "2460640") | |
| (timezone . "America/Los_Angeles") | |
| (place_url . "/United+States/California/San+Francisco/North+Beach") | |
| (place_type_id . "22") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ((query (results (table . ["atom" "csv" "feed" "flickr.photos.exif" "flickr.photos.info" "flickr.photos.interestingness" "flickr.photos.recent" "flickr.photos.search" "flickr.photos.sizes" "flickr.places" "flickr.places.info" "geo.places" "geo.places.ancestors" "geo.places.belongtos" "geo.places.children" "geo.places.neighbors" "geo.places.parent" "geo.places.siblings" "geo.placetypes" "gnip.activity" "html" "json" "local.search" "microformats" "mybloglog.community.find" "mybloglog.member" "mybloglog.member.contacts" "mybloglog.member.newwithcontacts" "mybloglog.member.newwithme" "mybloglog.members.find" "rss" "search.images" "search.news" "search.web" "upcoming.category" "upcoming.country" "upcoming.events" "upcoming.events.bestinplace" "upcoming.groups" "upcoming.metro" "upcoming.state" "upcoming.user" "upcoming.venue" "weather.forecast" "xml" "yap.setsmallview"])) (diagnostics (build-version . "911") (service-time . "0") (user-time . "1") (publiclyCallable . "true")) (uri . "http://query.yahooapis.com/v1/y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| require 'mathn' | |
| def sign(x) | |
| return 1 if x > 0 | |
| return -1 if x < 0 | |
| return 0 | |
| end |