Skip to content

Instantly share code, notes, and snippets.

@fukayatsu
Last active December 29, 2015 05:49
Show Gist options
  • Save fukayatsu/7625173 to your computer and use it in GitHub Desktop.
Save fukayatsu/7625173 to your computer and use it in GitHub Desktop.
function blog() {
cd /Users/fukayatsu/github/fukayatsu.github.io
if [ $1 ]
then
file=$(bundle exec middleman article $1 | \
grep 'create\|update' | \
awk '{print $3}')
url=$(echo $file | \
sed -e 's/source\/posts/http:\/\/fk.dev/' | \
sed -e 's/\.html\.md/\//' | \
sed -e 's/\(201[0-9]\)-\([0-9][0-9]\)-\([0-9][0-9]\)-/\1\/\2\/\3\//')
subl $file
open $url || echo preview: $url
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment