Created
March 23, 2020 18:51
-
-
Save dbalatero/b2e2511506c48ce6ddfdad60a3b543bd to your computer and use it in GitHub Desktop.
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
# some pdf file | |
def applicant_name | |
{ "form[0].applicant[1].name" => answers.applicant.name } | |
end | |
def applicant_email | |
{ "form[0].applicant[1].email" => answers.applicant.email } | |
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
# some pdf file | |
label "form[0].applicant[1].name" | |
field :applicant_name do | |
answers.applicant.name | |
end | |
label "form[0].applicant[1].email" | |
field :applicant_email do | |
answers.applicant.email | |
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
# move your cursor to line 1 | |
# start macro recording | |
qa | |
# move to inside of label "" | |
/label | |
<enter> | |
f" | |
l | |
# yank inside quotes to register "l" | |
"lyi" | |
# delete line | |
dd | |
# jump to field symbol name | |
f: | |
l | |
# yank word into register "f" | |
"fyw | |
# replace with a method definition | |
dd | |
O | |
def | |
<esc> | |
"fp | |
# change method body | |
j | |
0 | |
w | |
i | |
{ "" | |
<esc> | |
"lp | |
2w | |
i | |
=> | |
<esc> | |
A | |
} | |
<esc> | |
j | |
# press q again to stop recording | |
q | |
# the first block will be changed | |
# fire the macro a second time with: | |
@a | |
# second block is now changed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment