Created
November 2, 2016 16:21
-
-
Save sunmockyang/4ca4a3f0a5113179baf23b46f81f1793 to your computer and use it in GitHub Desktop.
Outputs today's sunrise 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
| require "JSON" | |
| require 'net/http' | |
| require 'uri' | |
| def open(url) | |
| Net::HTTP.get(URI.parse(url)) | |
| end | |
| # Put in your own latitude and longitude | |
| puts JSON.parse(open('http://api.sunrise-sunset.org/json?lat=45.4215000&lng=-75.6972000&formatted=0&date=today'))["results"]["sunrise"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment