Skip to content

Instantly share code, notes, and snippets.

@randyzwitch
Created November 23, 2014 04:00
Show Gist options
  • Save randyzwitch/062cf28ed1da503c36e9 to your computer and use it in GitHub Desktop.
Save randyzwitch/062cf28ed1da503c36e9 to your computer and use it in GitHub Desktop.
Update: Macros in Julia for code refactoring
macro endpoint(name, path)
quote
function $(esc(name))(; options=Dict{String, String}())
r = get_oauth($"https://api.twitter.com/1.1/$path", options)
return r.status == 200 ? JSON.parse(r.data) : r
end
end
end
@endpoint get_help_configuration "help/configuration.json"
@endpoint get_help_languages "help/languages.json"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment