Pete Corey Writing Work Contact

Scheduling Posts with Jekyll, Github Pages & Zapier

Written by Pete Corey on Dec 29, 2014.

I’ve written a few times about using Jekyll and Github Pages as my blogging stack. So far, I’ve been very satisfied with this setup except for one pain point. I’m unable to easily write posts and schedule them to go live at a later date… Until now! While I could have written and hosted a script or two to accomplish what I was after, I wanted to take a different approach. I ended up using Zapier to automate the publishing of posts at future dates.

The Game Plan

The basic idea behind using Zapier to schedule future Jekyll posts with Github Pages is two part. First, create a git branch that holds commits for posts you want scheduled for release. A zap listens for commits pushed to this branch and creates a Google Calendar event at the date and time you want to schedule the post to go live. A second zap listens for these calendar events to start and creates an instant-merging pull request into master from the post’s commit.

Scheduling Posts

The first zap will listen for commits to a specific branch (I called mine scheduled) on a Github repository.

When a commit is pushed, Zapier will create a Google Calendar event at the date and time specified in the git commit message. It will also store the SHA identifying the commit in the location attribute of the calendar event.

It’s important to note that scheduling posts in this way means that the only text you can put into your git commit message is the date and time the date will go live. Actual commit messages may give unexpected results.

I’ve shared a zap template for this step.

Merging to Master

The next step of the process happens when the Google Calendar event starts (when your post is scheduled to go live). A second zap is triggered when this event starts. The zap pulls the post’s SHA from the location attribute of the event and create a Github merge request into master. By making the merge an “instant merge”, the commit will immediately be pulled into master, which in turn causes Github to rebuild your Jekyll site.

I’ve shared a zap template for this step as well.

On Zapier & Final Thoughts

Sure, I could have implemented this as a shell script or simple program in a variety of ways, but I think that Zapier is a really elegant solution to this problem. The way Zapier composes webapps together is very interesting, vastly useful and can come with some unforeseen benefits. For example, using Google Calendar as the driver of my scheduling system has an added benefit of giving me a nice user interface to modify release dates of posts before they go live. I could also easily trigger things like tweets, emails, etc. to be send when a post goes live.

I did find myself wishing that Zapier came with a few string manipulation features. Instead of dumping the entire git commit into the calendar’s schedule date, I was hoping to slice out only a portion of the commit message, or use the last line or something. Maybe this kind of functionality will come in the future, or maybe it already exists and I just couldn’t find it. See my followup post on using named variables to extract a schedule date from the git commit message.

As a proof of concept, I’ll be scheduling this post to go live on December 29th, 2014. See you then!

Hide Menu: My First Sublime Text Plugin

Written by Pete Corey on Dec 24, 2014.

My new bspwm setup currently doesn’t have a pretty GTK theme installed, so the menu in Sublime Text looks fairly unattractive. With my workflow, whenever I open Sublime Text (subl .), the menu is always shown, regardless of if I hid it during my last session. So what’s the solution to hiding the menu at startup? Find a plugin, of course! Oh, there are no plugins that do this? Write a plugin, of course!

My current bspwm setup

Building the Plugin

Unfortunately, I’ve never written a Sublime Text plugin. Thankfully there are many resources to help out a person in my situation. This post explained how to create a new Sublime Text plugin. This one showed how to run code when Sublime Text is started. And finally, this guy gave me the command I needed to execute to toggle the menu visibility. After testing everything out, I researched how to submit the plugin to package control, and made my pull request. The final result is available via package control, on github, and the incredibly simple code is below:

import sublime
import sublime_plugin

def plugin_loaded():
    window = sublime.active_window()


Unfortunately, the plugin has its issues. As mentioned here, with some workflows, Sublime Text will remember the state of the menu’s visibility and the toggle_menu command issued by my plugin will show the menu instead of hiding it. As far as I know, there is no way to either detect if the menu is visible before issuing the toggle, or sending some kind of “set visibility” command rather than a toggle. I’ve opened an issue about this on the project’s github. If you have a solution or any feedback about it, please leave a pull request/comment.

BYO Meteor Package

Written by Pete Corey on Dec 22, 2014.

This morning I started working on a quick project called Suffixer, which is a tool to help you find interesting domain names. For this project I needed a searchable english dictionary accessible from within a Meteor app. After some sleuthing, I decided that adambom’s dictionary JSON would be my best bet. The next step was importing that JSON data into Meteor in the most “Meteor way”.

Creating a Package

Since this is a fairly reusable component, I decided to throw it into a Meteor package. Doing this is as simple and running a “create package” command inside your Meteor project:

meteor create --package pcorey:dictionary

This will create a package called pcorey:dictionary in the packages directory within your project. There you’ll find package.js and other files to get you started. Next, throw some code into the file referenced in the onUse section of package.js. Finally, add the package to your project:

meteor add pcorey:dictionary

You’ll notice that Meteor will immediately pick up this change and build your package into the project. For local packages, this is all you need to get started.

However, I wanted to keep this package in its own github repo and eventually publish it to Meteor’s package repository. With that in mind, I pulled it out of my packages folder within my project and into its own directory.

Package Assets

If you take a look at my package’s github repository, you’ll notice that I’m including dictionary.json in the package.js file:

Package.onUse(function(api) {
    api.addFiles('dictionary.json', 'server', {isAsset: true});

I’m passing an additional two arguments to this call of addFiles. The 'server' argument is straight forward; it’s telling meteor to only make this file available to the server. The {isAsset: true} argument is used to incidcate that this file should be loadable as an asset. This is a fairly undocumented feature that I only discovered after some frantic googling. Adding the file to the package in this way lets you load it as an asset in the package:

var dictionary = JSON.parse(Assets.getText('dictionary.json'));


My package defines a collection called Dictionary that I intended to be used on the client side by projects importing this package. However, without explicitly exporting Dictionary, it will remain hidden within the package’s scope.

You can specify your package’s exports in your package.js file. Here’s I’m exporting the Dictionary collection defined in dictionary.js and making it accessible to both the client and the server:

api.export('Dictionary', ['client', 'server']);

Publishing Your Package

Once you have your package completed, the next step is to publish it to Meteor’s package repository:

meteor publish --create

When making changes to you package, be sure to increment your version in package.js and then re-publish the package:

meteor publish

You can now add your package to any Meteor project using the standard meteor add command. That’s it!