Skip to content

Instantly share code, notes, and snippets.

@lackac
Last active August 5, 2018 15:26
  • 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
Save lackac/b10dff552de741d0426c7d2bd7e54454 to your computer and use it in GitHub Desktop.
1. Copy from iBooks a code snippet; 2. Run ibook_paste; 3. Paste into text editor
#!/usr/bin/env bash
pbpaste \
| ruby -ne '
BEGIN { $blanks = [] }
if ($_ =~ /^\s*$|^Excerpt From: */)
$blanks << $_
else
puts($blanks)
$blanks = []
puts $_.gsub(/^“|”$|\s*\p{InDingbats}$/, "")
end
' \
| pbcopy
@lackac
Copy link
Author

lackac commented Aug 5, 2018

Turns this:

“defmodule KeyValueStore do
  def start() do
    GenServer.start(KeyValueStore, nil, name: KeyValueStore)    ❶
  end”

Excerpt From: Saša Jurić. “Elixir in Action, Second Edition MEAP V03.” iBooks. 

into this:

defmodule KeyValueStore do
  def start() do
    GenServer.start(KeyValueStore, nil, name: KeyValueStore)
  end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment