Skip to content

Instantly share code, notes, and snippets.

Avatar

StevenSolomon steven-solomon

View GitHub Profile
@steven-solomon
steven-solomon / 1.exs
Last active Jul 20, 2019
What Is A GenServer?
View 1.exs
# test/account_test.exs
defmodule AccountTest do
use ExUnit.Case
test "fails" do
assert true == false
end
end
@steven-solomon
steven-solomon / GenServerCall.ex
Last active Jul 18, 2019
Code for My First Week With Elixir as a Rubyist
View GenServerCall.ex
defmodule OurServer do
use GenServer
# ...
def call({:message, caller_data}, _from, state) do
{:reply, caller_data, [caller_data]}
end
end
@steven-solomon
steven-solomon / add_job.rb
Created May 6, 2018
Don't Repeat Yourself
View add_job.rb
def random_person
names = %w(Mike Zoe Adam Sarah)
jobs = %w(Astronaut Engineer Painter Day-Trader Theoretical-Physicist)
Person.new(random_item(names), random_item(jobs))
end