Skip to content

Instantly share code, notes, and snippets.

@dviramontes
Created January 30, 2023 19:58
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Copy to paste buffer from within iex
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