Skip to content

Instantly share code, notes, and snippets.

@mattSpell
mattSpell / gist:2aa6711dfd1590c49ce4
Created December 11, 2015 01:38
elixir GenServer issue
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
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
@mattSpell
mattSpell / Web Content Scrapers
Created September 8, 2014 18:24
Web Content Scrapers
#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.