Skip to content

Instantly share code, notes, and snippets.

@randyzwitch
Last active August 29, 2015 14:09
Show Gist options
  • Select an option

  • Save randyzwitch/ac7addbb6f2ddf6f6651 to your computer and use it in GitHub Desktop.

Select an option

Save randyzwitch/ac7addbb6f2ddf6f6651 to your computer and use it in GitHub Desktop.
Metaprogramming in Julia
funcname = (:get_help_configuration, :get_help_languages, :get_help_privacy, :get_help_tos, :get_application_rate_limit_status)
endpoint = ("help/configuration.json", "help/languages.json", "help/privacy.json", "help/tos.json", "application/rate_limit_status.json")
for (func, endp) in zip(funcname, endpoint)
@eval function ($func)(; options=Dict{String, String}())
r = get_oauth($"https://api.twitter.com/1.1/$endp", options)
return r.status == 200 ? JSON.parse(r.data) : r
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment