Skip to content

Instantly share code, notes, and snippets.

@xmunoz
Created October 8, 2016 15:21
Show Gist options
  • Save xmunoz/c04f946d923179ad197da248b25de3e5 to your computer and use it in GitHub Desktop.
Save xmunoz/c04f946d923179ad197da248b25de3e5 to your computer and use it in GitHub Desktop.
try to learn julia
__precompile__()
module Molcajete
import Requests: get, post, put, delete, options, json
global base_url = "https://api.meetup.com/"
if !haskey(ENV, "MEETUP_API_TOKEN")
error("MEETUP_API_TOKEN environment variable is required.")
end
global api_token = ENV["MEETUP_API_TOKEN"]
type Event
id::Int
name
datetime::DateTime
end
type Meetup
id::Int
name
city
country
end
type MeetupMember
id::Int
name
meetups::Meetup[]
function show_calendar(meetup_name::String, month::Int, year::Int)
meetups = find_common_meetups(meetup_name)
events = get_events(meetups, month, year)
plot_histogram(events)
end
function find_common_meetups(name)
meetup = get_meetup(name)
members = get_meetup_members(meetup)
common_meetups = Meetup[]
for mem=members
push()
end
end
function get_meetup(name):
response = get("$base_url$meetup_name", query = Dict("signed" => true, "key" => api_token))
if !response.status == 200
error(response.status)
end
jr = json(response)
m = Meetup(jr.id, jr.urlname, jr.city, jr.country)
function get_events(meetups::meetups, month::Int, year::Int)
end
end
Molcajete.show_calendar("Julia-Users-Group", "11", "2016")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment