merry_christmas v0.1.0 MerryChristmas

Simple Christmas app and library.

Use git to fetch this repo like: git clone repo_url. Fetch deps by: mix deps.get. Then compile app by running: mix escript.build. Finally run it like: ./merry_christmas josé_valim or ./merry_christmas "José Valim".

or:

Add merry_christmas to your list of dependencies in mix.exs:

def deps do
  [
    # your other deps here ...
    {:merry_christmas, "~> 0.1.0"},
  ]
end

and use method from this module.

Summary

Functions

Main method called when binary is runned If you pass only one argument (your name) then this app will print wishes. Otherwise this app will print it’s usage

Pass your wishes in List. This method will join them by joiner and print to console

This method fetch (by send GET request) page using url. Then it looks for elements matching selector gets random element of that list. Finally method call &print_wishes/2 with greating, random wish and my wish

Functions

main(arg1)

Main method called when binary is runned If you pass only one argument (your name) then this app will print wishes. Otherwise this app will print it’s usage.

wishes_for(name, url \\ "http://www.my-best-wishes.com/holidays/christmas-wishes.php", selector \\ "li")

This method fetch (by send GET request) page using url. Then it looks for elements matching selector gets random element of that list. Finally method call &print_wishes/2 with greating, random wish and my wish.

Example:

name = "José Valim"
MerryChristmas.wishes_for(name)

# your url and selector:
url = "url_to_page_with_wishes"
selector = "selector_to_fetch_wishes"
MerryChristmas.wishes_for(name, url, selector)