Skip to content

Instantly share code, notes, and snippets.

View SophieDeBenedetto's full-sized avatar

Sophie DeBenedetto SophieDeBenedetto

  • GitHub
  • New York, NY
View GitHub Profile
Accountant.product_of_equals_twenty_twenty([979, 1721, 366, 299, 675, 1456])
=> 514_579
defmodule Accountant do
@sum 2020
def product_of_equals_twenty_twenty([_head | tail] = list) do
product = get_two(list)
# coming soon!
end
end
##### PROMPT #####
# Find the two entries in a given list that sum to 2020 and then multiply those two numbers together
defmodule Accountant do
@sum 2020
defguard equals_twenty_twenty(first, second) when first + second == @sum
def product_of_equals_twenty_twenty(list, product \\ nil)
def product_of_equals_twenty_twenty(_list, product) when product != nil, do: product
defmodule SpyRadio.IntegrationTest do
use ExUnit.Case
test "the consumer receives a message when one is published to its queue" do
consumer_pid = start_supervised!(SpyRadio.RabbitMQ.Consumer)
:erlang.trace(consumer_pid, true, [:receive])
SpyRadio.RabbitMQ.Publisher.publish("some message")
assert_receive {:trace, ^consumer_pid, :receive, {:basic_consume_ok, %{consumer_tag: _tag}}},
1000
{:trace, consumer_pid, :receive, {:basic_consume_ok, %{consumer_tag: _tag}}
defmodule SpyRadio.IntegrationTest do
use ExUnit.Case
test "the consumer receives a message when one is published to its queue" do
consumer_pid = start_supervised!(SpyRadio.RabbitMQ.Consumer)
:erlang.trace(consumer_pid, true, [:receive])
SpyRadio.RabbitMQ.Publisher.publish("some message")
end
end
defmodule SpyRadio.IntegrationTest do
use ExUnit.Case
test "the consumer receives a message when one is published to its queue" do
consumer_pid = start_supervised!(SpyRadio.RabbitMQ.Consumer)
:erlang.trace(consumer_pid, true, [:receive])
end
end
defmodule SpyRadio.IntegrationTest do
use ExUnit.Case
test "the consumer receives a message when one is published to its queue" do
consumer_pid = start_supervised!(SpyRadio.RabbitMQ.Consumer)
end
end
```insights
some text
```
func MergeCOntributors(primaryAccount, secondaryAccount) error {
// Create a WaitGroup to manage the goroutines.
var waitGroup sync.WaitGroup
c := make(chan error)
// Perform 3 concurrent transactions against the database.
waitGroup.Add(3)
go func() {
waitGroup.Wait()