Skip to content

Instantly share code, notes, and snippets.

@timm-oh
Created January 21, 2025 16:30
Show Gist options
  • Save timm-oh/a5cb16b9e0ede9bd8b19f519b72bef25 to your computer and use it in GitHub Desktop.
Save timm-oh/a5cb16b9e0ede9bd8b19f519b72bef25 to your computer and use it in GitHub Desktop.
defmodule Helpers do
def copy(term) do
text =
if is_binary(term) do
term
else
inspect(term, limit: :infinity, pretty: true)
end
port = Port.open({:spawn, "pbcopy"}, [])
true = Port.command(port, text)
true = Port.close(port)
:ok
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment