Skip to content

Instantly share code, notes, and snippets.

@al-the-x
Created June 1, 2015 19:51
Show Gist options
  • Select an option

  • Save al-the-x/23830b62877f58c993f2 to your computer and use it in GitHub Desktop.

Select an option

Save al-the-x/23830b62877f58c993f2 to your computer and use it in GitHub Desktop.
Copy-pasta FU for managing files and such
between {
if [ $# -lt 1 ]; then
cat <<'USAGE'
usage: between START END
Print input from `stdin` that appears between `START`
and `END` markers, as long as they appear on a single
line.
EXAMPLE
$> between.zsh | between USAGE EXAMPLE
usage: between START END
Print input from `stdin` that appears between `START`
and `END` markers, as long as they appear on a single
line.
USAGE;
return 1
fi
if [ $# -gt 1 ]; then
gawk "/${1}/{keep=1}/${2}/{keep=0} keep"
else
gawk "/${1}/{keep=1}keep"
fi
}
#!/usr/bin/env zsh
## TODO: find out if there's a better way to do this...
function _error {
echo 'error: ' $1 >&2
}
function _usage {
cat <<'USAGE'
usage: copy-pasta XX--Assignment-Name
Create a `README.md` file in `XX--Assignment-Name/` copying the contents of
`.template/ASSIGNMENT.md` or the file named by the environment variable `$TEMPLATE`,
if it exists. Also make a branch in the current repo named similarly (lowercased)
and add the `README.md` file to the index.
USAGE
}
if [[ $# -lt 1 ]]; then
_error 'missing argument'
_usage; exit 1
fi
git checkout -b $1:l \
&& ginstall -vCD .templates/${TEMPLATE:-'ASSIGNMENT.md'} $1/README.md \
&& git add $1 \
&& git status -s
# vim: ft=zsh
@al-the-x
Copy link
Copy Markdown
Author

al-the-x commented Jun 1, 2015

This cohort, I give my students a checklist inside of a Markdown code block with requirements:

* [ ] **Yak Shaving**
  * _WIP Issue_: `13 -- In the HTML of the Night`
  *  _WIP Branch_:
    * `USERNAME.github.io:journal-week-3`
    * `TIY-Assignments:13--html-of-the-night`
  * _WIP Files_:
    * `USERNAME.github.io`
      * `about/html.md`
      * `*.md` (reflective journal)
      * `*.md` (tutorial journal)
    * `student-roster`
      * `2015-05/FEE/TEMPLATE.md`
    * `TIY-Assignments`
      * `VerticalTimeline/`
        * `index.html`
        * `js/main.js`
        * `sass/main.scss`
        * `bower.json`
        * `package.json`
      * `MultiColumnForm/`
        * `index.html`
        * `js/main.js`
        * `sass/main.scss`
        * `bower.json`
        * `package.json`
. . .

...that they copy-pasta into their Issues. I also write up some fun checkpoints for each part of the assignment that they can check off as they go. In later weeks, I write up fewer and fewer checkbox and make them fill in "the plan".

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