I’ve been to a number of conferences and talks recently and I’ve developed a habit of live-blogging my notes: getting them up online as quickly as possible.
More on that in a future post but I want to talk about how I am able to start taking notes fast, and publish them even faster (when a talk finishes, lots of people will be trying to get out of the row of seats past me!).
NOTE: The scripts below assume editing with terminal vim. It might be more flexible to switch this out for
$VISUAL environment variable (?), but if you use a different editor you’ll probably
just want to replace
vim with whatever command you use to boot up your editor - e.g.
The octopress command for creating a post is
rake new_post["The name of my
post"]. I’d then typically select the filename it outputs with the mouse,
paste that into the command line and open it with vim. That’s way too much
typing, and any seasoned vim user would wince at the word “mouse”.
Here’s a function which lets me type
newpost "The name of my post" and creates
the post, isolates it and opens it in one step:
My dotfiles are shared between
multiple machines, so the
BLOG_HOME environment variable is set in a local
I’m pretty new at shell scripting, so if you know of a way to make this better or more robust, please let me know in the comments.
Notice in the
newpost function I’ve got
rake isolate["$post_path"] - that’s a
nifty task provided by Octopress which gets around the fact that when you generate
your Octopress blog it has to rebuild the entire site (?) which can be very slow.
Unfortunately it doesn’t seem to be documented, but you can see the source in the
Rakefile of your Octopress install.
Side note: run
rake -T in your blog directory to see all of the Octopress commands #protip
rake isolate moves all posts into
source/_stash, unless they match the given
string in their title. This means that when you’re previewing your post with
it’s much faster to re-generate because it’s only having to handle one post each time.
If you’re running this manually, there’s no need to pass the whole path: you can just
find one of two words which are unique in the filename of your post and use that - e.g.
You can put your stashed posts back with
Listing and revisiting posts
A couple of things I find myself needing to do fairly often:
- Make an edit to the post I was most recently editing
- Find a post where I can’t remember the title was
The following aliases achieve that:
gen:deploy rake task is a built-in alias for running the
:deploy tasks, but again, typing
rake gen:deploy is just too much typing, hence: