This file contains hidden or 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
defmodule MyApp.MainWorker do | |
use GenServer | |
# Client | |
def start_link(default) do | |
GenServer.start_link(__MODULE__, default) | |
end | |
def add(pid, num) do | |
GenServer.call(pid, {:add, num}) | |
end |
This file contains hidden or 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
defmodule BusTracker.Session do | |
alias BusTracker.User | |
import Ecto.Repo | |
use Bustracker.Web, :model`? | |
def login(params, repo) do | |
user = repo.get_by(User, email: String.downcase(params["email"])) | |
case authenticate(user, params["password"]) do | |
true -> {:ok, user} | |
_ -> :error |
This file contains hidden or 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
#Web Content Scrapers: | |
##Recommendation: | |
- open-uri - http://ruby-doc.org/stdlib-2.1.0/libdoc/open-uri/rdoc/OpenURI.html | |
to be used along with: | |
- Nokogiri - http://nokogiri.org/ to parse through the HTML | |
##Notes: | |
- In the Ruby Toolbox, the top 2 are Anemone and Pismo, but they are intended for getting metadata from web sites, not necessarily the html content. |