TL;DR Add field punning to maps in Elixir
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 LoginService do | |
def call(attrs) do | |
with {:ok, profile_id} <- login_with_auth(attrs), | |
{:ok, user} <- lookup_user(profile_id) do | |
send_user_refresh_request(user) | |
{:ok, %Authentication{id: user.id, user: user}} | |
else | |
error -> error | |
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 P do | |
defmacro __using__(_opts) do | |
quote do | |
import P | |
Module.register_attribute(__MODULE__, :plugs, accumulate: true) | |
@before_compile P | |
end | |
end | |
defmacro __before_compile__(env) do |
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
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle' | |
}); |
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
1) test .process with no meta it creates a message record (WireTap.MessageConsumerTest) | |
test/consumers/message_consumer_test.exs:35 | |
match (=) failed | |
The following variables were pinned: | |
message_body = %{"action_code" => 4, "institution_id" => "INS-3887fd5a-6e00-90ce-06f0-3e446c0233a3", "job" => %{"checked_at" => "2016-08-03T12:53:05.942Z[Etc/UTC]", "created_at" => "2016-08-03T12:52:36Z[Etc/UTC]", "finished_at" => "2016-08-03T12:53:05Z[Etc/UTC]", "job_id" => "JOB-d2011b94-423a-eebe-6f98-cf370558d029", "job_status" => %{"job_status_id" => 6, "job_status_name" => "COMPLETED"}, "started_at" => "2016-08-03T12:52:36Z[Etc/UTC]", "updated_at" => "2016-08-03T12:53:05Z[Etc/UTC]"}, "member_id" => "MBR-95b5b0d9-f315-7930-1975-a97eaafa1a6f", "previous_job_status" => %{"job_status_id" => 4, "job_status_name" => "TRANSFERRED"}, "ready_for_import" => true} | |
meta = %{} | |
code: %{correlation_id: nil, created_at: _, event: "updated", id: _, message: ^message_body, meta: ^meta, producer: "mx", pr |
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
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle' | |
}); |
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
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle' | |
}); |
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
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
actions: { | |
callParent() { | |
this.sendAction('callParent', this.get('name')); | |
} | |
} | |
}); |
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 MessageRouter.DSL do | |
alias MessageRouter.Route | |
alias MessageRouter.QueueHandler | |
alias MessageRouter.Supervisor | |
defmacro __using__(_args) do | |
quote do | |
import MessageRouter.DSL | |
Module.register_attribute(__MODULE__, :routes, accumulate: true) |
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
def execute(command, logger) | |
require 'open3' | |
_, stdout, stderr, process = Open3.popen3(command) | |
unless process.value.success? | |
logger.error(command) | |
logger.error(stdout.read) | |
logger.error(stderr.read) | |
exit process.value.exitstatus |
NewerOlder