Created
August 20, 2015 10:33
-
-
Save alemar11/a761b53ca0d47485e9c3 to your computer and use it in GitHub Desktop.
Zen Swift script
This file contains 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 xcrun swift | |
import Foundation | |
func Zen() -> String? { | |
if let url = NSURL(string: "https://api.github.com/zen"), data = NSData(contentsOfURL: url), zen = NSString(data: data, encoding: NSUTF8StringEncoding){ | |
return zen as String | |
} | |
return nil | |
} | |
print(Zen() ?? "No Zen, Sorry!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment