Fantastically Good Reminder Parser for Drafts 5

2018-07-11✪Permalink

Following my recent blog post about my Fantastically Good Event Parser, which to my great delight was featured on MacStories, I received quite a few requests to create something similar for Reminders. Fantastical, which inspired the event parser, also allows you to create reminders in the system Reminders app using natural language. The interface within the app that allows you to enter calendar events also allows you to create reminders by including words like reminder, task, or todo in the text entered.

I thought about replicating this functionality within my previous action, but this didn’t feel quite right in Drafts. Adding calendar events and setting a reminder are conceptually quite different kinds of action, so I decided to build a separate action just for reminders. Being separate, I also decided that requiring a keyword like reminder or todo didn’t make much sense for this use case, so I’m diverging slightly from the traditional Fantastical functionality here.

Otherwise, it works very similarly to Fantastical. Reminders can be entered in the form Thing Tuesday 5pm !!! /p to add a reminder called Thing with a due date of Tuesday, with a reminder at 5pm that day, with high priority, and stored in my Personal reminders list. Here are some details on how the parsing works:

  • The name of the reminder is whatever is left when the date, time, priority, and list name are removed. 1
  • The date and time can be entered in pretty much any normal format. Again, I’m using chrono.js behind the scenes here. Dates without times will default to having an alert at noon.2
  • Priority is optional and can be set as !, !!, or !!!.
  • The reminder list is set using a forward slash followed by one or more letters from the beginning of the name of the list. If a matching list is not found, or if no list is specified, the reminder will go into the system default reminders list.

I’m grateful to Greg Pierce, the developer of Drafts for recently adding some functionality to the app’s scripting engine in version 5.3 in response to my request. Without these changes, I wouldn’t have been able to make this action as fully functional as I wanted it to be. Being on the the beta channel in Slack, and now in the Drafts forum, I can honestly say that Greg is one of the most responsive developers I have come across. Even when he doesn’t plan to implement a feature request immediately (or at all), he explains his reasons clearly in a way that us non-developers can understand. Thanks again, Greg.

You can find my Fantastically Good Reminder Parser in the Action Directory.

  1. Note that I’ve decided not to automatically remove words like due or by, so if you include these they will be added to the name of the reminder. I’d suggest omitting them. 

  2. The default alarm time can be changed by tweaking the script. If there’s anyone who would like the parser to interpret dates given in the standard British format of dd/mm/yyyy, you can also change the US at the beginning of the third script step to GB

Fantastically Good Event Parser for Drafts 5

2018-06-27✪Permalink

I used to have an action in Drafts 5 for adding calendar events using Fantastical, the favoured calendar app of many because of its ability to interpret events entered in natural language. Fantastical allows you to enter things like Meeting on Thursday at 5pm and then generates a calendar event by parsing out the information you provided. Compared to tapping on dialog boxes and scrolling date pickers in other calendar apps, it feels fast and easy.

The way the action works is to take each line of the draft and run it through the Fantastical URL scheme. Sometimes I would run this action with a lot of different events1 which meant watching as my iPad madly bounced back and forth from Drafts to Fantastical. If I remembered, I would put the two apps in split view beforehand to speed things up, but even with the add=1 flag set in the URL scheme to avoid having to confirm each entry, Fantastical still shows an animation each time an event is entered, which slows things down.

The way apps like Fantastical actually integrate with the system calendar in iOS is via an API which allows direct manipulation of calendar events. You may have seen the Allow app to access the Calendar? prompt when first launching apps which use this. Drafts integrates this API into its scripting capabilities, and so it occurred to me recently that perhaps I could build a similar functionality within Drafts using JavaScript. This would allow me to use the system calendar app, which I prefer aesthetically over Fantastical, while retaining the ability to enter events in natural language.

What I’ve ended up creating has almost all of the same functionality as Fantastical, but since it does not rely on launching an external URL scheme, is considerably faster. You can enter multiple events, each on a different line, and have them all instantly added to your calendar without even launching another app. As with my Things Parser, I’ve leveraged the chrono.js library to do the natural language date parsing. My action supports the following things:

  • Dates and times entered in natural language2
  • Locations entered in the form at location or in location
  • Durations entered in the form 30 minutes or 2 hours3
  • Alerts entered in the form alert 30 minutes or alert 1 hour
  • The specific calendar where the event should be created in the form /family or simply /f4

Unfortunately, my script doesn’t yet support creating recurring events as Fantastical does. This currently isn’t built in to the scripting capabilities of the event object in Drafts, but I am hoping this might be added soon. When it is, I’ll be sure to update this action to support entering recurring events.

You can find my Fantastically Good Event Parser in the Action Directory.

  1. Each term, I used it to take a plain text version of my school timetable and add it to my calendar. 

  2. Events given with a date but without a time are assumed to be all-day events. Events with a given start time but no end time are assumed to be one hour long. 

  3. Note that the space is optional and that minutes and hours cannot be mixed. Minutes can be written as minutes, minute, mins, min, or m. Hours can be written as hours, hour, hrs, hr, h

  4. Your calendars will be searched for the one beginning with the string you’ve entered. If you have two calendars with the same first letter, such as tutoring and timetable, try being slightly more specific by writing /tu or /ti. If no calendar it specified, the event will be added to the default calendar. 

Drafts Actions for Markdown

2018-06-20✪Permalink

Here are a couple of Drafts 5 script actions I’ve been working on recently. A while back I created an action to create Markdown links in the reference style. This allows you to use the syntax [link text][1] in the body of the text, and then [1]: url at the bottom of the document. This is nice especially in long posts for keeping the body of the text uncluttered and readable.

The script automatically inserts the correct syntax both in the body and at the end, automatically incrementing the number each time you add a new link. If there is a URL in the clipboard, it will automatically use this.

What I’ve done more recently is to create a new, and similar, footnotes action. They are mutually compatible, so the incrementing of the reference number is shared. If there is text selected when the footnote action is run, it is moved into a footnote1. What you end up with is a mixed list of links and footnotes at the bottom of your document like this:

[1]: https://wordpress.com
[2]: https://wordpress.com/pricing/
[3]: https://jekyllrb.com
[4]: https://en.m.wikipedia.org/wiki/Ruby_(programming_language)
[5]: https://en.m.wikipedia.org/wiki/Markdown
[6]: https://en.m.wikipedia.org/wiki/HTML
[7]: https://en.m.wikipedia.org/wiki/Cascading_Style_Sheets
[8]: https://shopify.github.io/liquid/
[9]: https://pages.github.com/
[^10]: If you’re a teacher, however, you can apply to get a full Developer or Team plan for free, which include unlimited private repositories and unlimited users.
[11]: https://help.github.com/articles/configuring-jekyll-plugins/
[12]: https://github.com/barryclark/jekyll-now
[13]: http://www.barryclark.co
[14]: https://www.smashingmagazine.com/2014/08/build-blog-jekyll-github-pages/
[15]: https://itunes.apple.com/gb/app/termius/id549039908?mt=8&uo=4&at=1001lsF2
[16]: https://itunes.apple.com/gb/app/screens/id655890150?mt=8&uo=4&at=1001lsF2
[^17]: Please don’t read my early commit history!
[^18]: The one time when you wish a laptop didn’t have MagSafe.
[19]: https://itunes.apple.com/gb/app/xcode/id497799835?mt=12&uo=4&at=1001lsF2
[20]: https://desktop.github.com

Drafts 5 also allows you to set custom keyboard shortcuts for actions, so I currently have ⌘K for inline link, ⌘⇧K for reference links, and ⌘⇧⌥K for footnotes. It makes writing in Markdown feel completely frictionless.

If you like writing in Markdown, I hope you find these actions useful. You can find them here and here in the Action Directory.

  1. Like so 

Fraser Speirs on BYOD ↪︎

2018-06-18✪Permalink

A great series of tweets from Fraser Speirs, who ran the first one-to-one school iPad programme in the world:

It’s now entirely clear to me that BYOD is a failed idea in K-12 EdTech. A complete evolutionary dead-end.

This isn’t a platform-specific point. iPad or Chromebook, K-12 teachers, pupils, parents and schools need more consistency, predictability, control and supervision than BYOD can possible provide.

BYOD buries the cost of device management in individual staff effort. If you won’t do integration once at the school level, each teacher will do it daily at the classroom level and usually much worse.

The weaknesses of BYOD have been obvious to me in theory for at least half a decade but now we are seeing it play out in practice.

The very existence of the textbook shows we’ve understood for hundreds of years the importance of consistency in education. Teachers need to know their tools, and they need to know their students’ tools. Bring your own device is about as good a strategy as bring your own textbook.

New Blog, Same as the Old Blog

2018-06-17✪Permalink

To feel a real sense of ownership, sometimes you need to put something together yourself. And that’s what I recently decided to do with this blog. When I started writing here, I had things I wanted to share, and I needed a simple and straightforward way to share them. Wordpress.com was a great place to start: it let me get a domain name, customise how my site looked, and quickly get started on writing and publishing in Markdown, without having to worry about things like hosting.

More recently, however, I started to get a hankering to tinker in more detail. There were some things about my site I wanted to tweak and change, and I realised that a lot of these features were only available in the higher price plans on Wordpress. That got me searching for alternatives, and that’s when I came across Jekyll.

Jekyll is what’s called a static site generator. At its heart, it’s a programme in Ruby that takes a directory of text files in Markdown, HTML, and CSS, and spins them together into a bunch of web pages ready to be dropped onto a web server. The Markdown files are your blog posts, the HTML describes the layout of your posts, and the CSS says how it should be styled. The term static refers to the fact that the resulting web pages don’t change after they have been generated. This is the opposite of a dynamic web page, where the information the user sees on the page is generated continuously as they move around the site, usually with reference to some database behind the scenes. In a static site, the pages are regenerated only when the site is updated, which is perfect for a blog where most updates are just new posts.

With Jekyll, adding a new post is as simple as creating a new text file in a directory. The Ruby programme runs, creates new versions of all of your pages and pushes them to a web server. You can customise the way your site looks by tweaking the CSS, and you can adjust the structure of your site by altering the HTML templates, which are supercharged with the templating language Liquid.

Another big reason for moving to Jekyll is that my site is now incredibly portable. I’ll describe how I’m hosting it below, but because it’s just a bunch of static pages, I could host it on pretty much any web server. I need a computer to run the Ruby programme, but after that it just needs to send the files to a server and its job is done until the next update. I even managed to install Jekyll on my Raspberry Pi so it could do the processing for me, and in theory, it could even act as the web server too.

Getting Started

The easiest way to get started with Jekyll is to use GitHub Pages. GitHub is the biggest host of source code on the web. You can store your code there, and manage it using a system called Git. Collections of code (called repositories) can be stored there for free if they are public, and for a small fee if they are private1. For hosting a website which is by definition public, making the source files private isn’t necessary, so the free account is all you need. Jekyll itself is completely free and open-source, so along with GitHub Pages this gives you an extremely customisable and entirely free way to create and publish your own blog! The only cost is buying a custom domain name if you want one.

The best thing about using GitHub Pages is that you don’t have to worry about running Jekyll yourself or using a web server. GitHub just gives you a repository called username.github.io, you put your source files there, and all the processing and serving goes on behind the scenes on GitHub’s own servers. Then, as if by magic, Jekyll brings your site to life at https://username.github.io. Using GitHub Pages means you’re not running the Ruby programme yourself, which in turn restricts the options you have in terms of plugins. While I found the plugins available on GitHub Pages to be more then sufficient, if you really want to tinker down at the Ruby level, you will need to look at other hosting options.

You can start from scratch and create your HTML templates and CSS styling, but if like me you’re not an export on these things, it’s best to start from what someone else has done and then make it your own. On GitHub, this is a process known as forking. I used the wonderful Jekyll Now template by Barry Clark as my starting point. He has a more detailed post on how to do this, and there are some alternative templates he also recommends as starting points. Once you’ve done some customisation, you can hook up to your custom domain name and off you go.

The Right Tool for the Job

I wanted a way of building and managing my site which was compatible with using an iPad as my primary computer. While I think I’ve found a great way of managing the site and publishing new posts directly from my iPad, I have to say that it was the Mac that really excelled with the job of helping me build the site.

What I tried first was a little crazy. I would edit my source files on my iPad, push them up to GitHub, pull them back down onto my Raspberry Pi, which I controlled via my iPad using either SSH (using Termius) or VNC (using Screens). Then I would run Jekyll on the Pi, start a local web server on my network, and view the pages on my iPad. But as any programmer will tell you, it’s really important that the cycle of change the code, run the code, look at the output, change the code needs to be as fast and efficient as possible. This method was definitely not that. For one, the Pi was slow to build the site each time: it was often taking up to 30 seconds. Having to push to GitHub for every single tiny change is also not exactly how you’re meant to use it2.

I thought I would give it a go on the Mac instead, and this turned out to be a very good decision. As someone who would have considered themselves to have moved on from the Mac to live the iOS-only lifestyle, I have to give credit where credit’s due: it was the perfect tool for the job. My wife has an old mid-2012 MacBook Air with a battery so dead that it instantly turns off if the power is disconnected3, but after a recent reformatting and installation of High Sierra, it’s running pretty well. I installed Xcode, GitHub Desktop, and Ruby via RVM on the command line. Once you’ve got Ruby set up you can install Jekyll using these instructions. A tip if you are using GitHub Pages is to run the the command gem install github-pages. This installs all of the plugins that are compatible with GitHub Pages, and allows you to see your site exactly how it will appear on the web.

So why is the Mac so good at the job of building and testing a Jekyll site? For one thing, you are working with a lot of windows at once. I had several Xcode windows open with various Markdown, HTML, and CSS files that I was working on, I had the terminal open to run Jekyll and the local web server, I had Safari open to preview the site and to read documentation, and I had GitHub Desktop open to keep track of changes and push them to my site. The combination of autosave in Xcode, plus Jekyll automatically regenerating the local site whenever it detected changes to the source files, plus the web server continuously running, meant I could tweak something in a file, wait a few short seconds for Jekyll to rebuild, refresh Safari and view my changes, all on the same machine. It made things so much quicker. It really did give me a renewed appreciation for the Mac and the things it is really good at.

Managing the Site from iOS

Having said all that, I still use an iPad as my primary computer, and I wanted a good way to maintain the site on iOS. I needed a good way to work with GitHub from the iPad, and by far the best app to do this from is the wonderful Working Copy. It’s a fantastic Git client with one of the best sets of keyboard shortcuts and one of the most extensive URL schemes I have come across in any app. I’ve been working on some Drafts actions which leverage this URL scheme, so that I can publish posts like this one directly from Drafts with a single button. They’re still a work in progress, so that’s probably a topic for another post.

Tips and Tricks

Because I was running my Jekyll blog on GitHub Pages, I was somewhat constrained in terms of how I solved certain problems. For example, I wanted to have an Archive page, and while there were plenty of plugins available which use Ruby code to automatically generate an Archive page, I didn’t have the option of running these. Instead, I had to work within the bounds of what was possible within the Liquid template language. In the end, I was quite pleased with some of the solutions I came up with.

Archive Page

With the Archive page, what I wanted was a list of year and month headings, most recent at the top, with links to each of the posts under their respective headings. I did’t want to include months were there weren’t any posts, and I didn’t want to repeat months with more than one post. Here’s the code I used:

{% for post in site.posts %}

    {% assign current_post_year = post.date | date: "%Y" %}
    {% assign next_post_year = post.next.date | date: "%Y" %
    {% assign next_post_year = post.next.date | date: "%Y" %
    {% assign current_post_month = post.date | date: "%B" %}
    {% assign next_post_month = post.next.date | date: "%B" %}
    {% assign date_id = post.date | date: "%Y-%m" %}
    
    {% if post.next == nil %}
        <h1>{{ current_post_year }}</h1>
        <h2 id="{{ date_id }}">{{ current_post_month }}</h2>
    {% elsif next_post_year != current_post_year %}
        <h1>{{ current_post_year }}</h1>
        <h2 id="{{ date_id }}">{{ current_post_month }}</h2>
    {% elsif next_post_month != current_post_month %}
        <h2 id="{{ date_id }}">{{ current_post_month }}</h2>
    {% endif %}

    <p><a href="{{ site.baseurl }}{{ post.url }}">{{ post.title }}</a></p>
		
{% endfor %}

Basically, I print the post’s year and month, unless they are the same as the next post chronologically (which is further up the page). I also added id attributes to the months to act as HTML anchors. Then I made the date stamp on each post a link to {{ site.baseurl }}/archive#{{ page.date | date: "%Y-%m" }}, so that the user can click on the date stamp and be taken straight to the right section of the Archive page. You can try it by clicking the date stamp at the top of this post or by clicking here.

Tags Page

I used a similar trick with my Tags page, which collates all the different tags I have assigned to posts. It’s built using the following code:

{% assign all_tags = site.posts | map: "tags" | uniq | sort_natural %}
<div class="posts">
{% for tag in all_tags %}
    <h2 id="{{ tag }}">{{ tag }}</h2>
    {% for post in site.tags[tag] %}
        <p><a href="{{ site.baseurl }}{{ post.url }}">{{ post.title }}</a></p>
    {% endfor %}
{% endfor %}
</div>

The first line really shows the power of Liquid as a functional language: it fetches all the posts, gets a list of their tags, removes duplicates, and sorts them into alphabetical order. Then I just loop over the tags, printing each heading – again with an id attribute – along with links to all of the pages that have that tag. At the end of each post, I then have the following code:

{% for tag in page.tags %}
    {% if forloop.last %}
        <a href="{{ site.baseurl }}/tags#{{ tag }}" class="meta">{{ tag }}</a>
    {% else %}
        <a href="{{ site.baseurl }}/tags#{{ tag }}" class="meta">{{ tag }}</a>,
    {% endif %}
{% endfor %}

This lists the tags on the post (the last without a comma) and links them to the appropriate anchor on the Tags page. Here’s an example of a link to the tag for Notes on my Tags page.

Compared to the plugins which can do things like generate individual pages for each tag, I think I actually prefer this way of doing it. I like having single Archive and Tags pages which the user could easily do a text search on.

I wanted my site to natively support link posts. I added a custom field to my post front matter called titlelink:, and then used the following code to turn the title into a link and add a visual indicator when there was text in this field:

{% if page.titlelink %}
    <a href="{{ page.titlelink }}"><h1 class="entry-title">{{ page.title }} ↪︎</h1></a>
{% else %}
    <h1 class="entry-title">{{ page.title }}</h1>
{% endif %}

Popover Footnotes

Jekyll supports footnotes out of the box, but I wanted to implement inline, popover style footnotes like this one. There’s a JavaScript plugin called Bigfoot that can do this, so I created a js directory in my repository and put the bigfoot.min.js file in there. It wasn’t initially clear to me, but it turned out that I also had to have jQuery in there as well for it to work. I then put the following code into the default.hmtl template in my _layouts directory:

<script type="text/javascript" src="{{ site.baseurl }}/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="{{ site.baseurl }}/js/bigfoot.min.js"></script>
<script type="text/javascript">
    $.bigfoot();
</script>

Images Directory

I configured my posts’ permalinks to be of the form https://polymaths.blog[/linked]/yyyy/mm/slugified-title, and so to make it easy to reference images inside a post, I set up the directory structure within my images folder to match this. FN So for example, if the URL of the post ends with /2018/06/post-title then the path of an image for that post would be /images/2018/06/post-title/image-name.jpg. This allows me to use a simple combination of liquid tags in my Markdown image links like so:

![Image name]({{ site.baseurl }}/images{{ page.url }}/image-name.jpg)

GitHub does have a notional limit on repositories of 1GB, so at some point I’ll probably have to host my images elsewhere, but for now it’s a good solution.

Final Thoughts

Rebuilding my blog with Jekyll has been great fun and I’ve learned a lot. It’s let me get to grips with some of the basics of web programming, which is something I’d like to develop further in the future. Along the way I’ve used some great tools, from my intrepid little Raspberry Pi, to my old but reliable MacBook Air, to the incredible Working Copy app for iOS.

Here’s to the new and improved PolyMaths. Now to get writing!

  1. If you’re a teacher, however, you can apply to get a full Developer or Team plan for free, which include unlimited private repositories and unlimited users. 

  2. Please don’t read my early commit history! 

  3. The one time when you wish a laptop didn’t have MagSafe. 

Things Parser 2.0 for Drafts 5

2018-04-18✪Permalink

Today is release day for the wonderful Drafts 5. There are a few great reviews out there, not least Tim Nahumck, who’s published an amazingly comprehensive review over at MacStories. Also worth checking out Rosemary Orchard’s review over on her blog.

I haven’t been writing a review, but since joining the beta in January I have been spending a lot of time getting to grips with the app’s new action scripting capabilities. Drafts 5 allows you to write code in JavaScript to manipulate the content of drafts in almost limitless ways, including integration with other apps via URL schemes, and with web services via their APIs. The developer Greg Pierce of Agile Tortoise has done an amazing job of abstracting away a lot of the complexity of integrating with these apps and services by creating a series of JavaScript objects that can be directly manipulated within the code. If you’re interested in how to do this, check out his comprehensive scripting documentation.

I went into the beta programme knowing basically zero JavaScript, and a few months later I’m pleased to say I have come out having learned a huge amount. I’ve written a few script actions so far, and with each one my knowledge of the language has steadily improved. I wrote previously about my Things Parser, inspired by Federico Viticci’s idea for a workflow that allows quick entry of multiple items into Things 3 using natural language. It takes multiple tasks, each entered on a separate lines within a draft, with special characters denoting metadata for each task, and sends them to Things with a single x-callback-url. I built a JavaScript version of his workflow, which expanded the natural language support, and added support for additional metadata such as deadlines and checklists.

Since then, I’ve been working on developing my knowledge of the object-oriented aspects of JavaScript. While technically JavaScript is a prototype-based language rather than a class-based language, it does have support for classes. I was keen to try to build a programme based on classes, and while mind-bending at times, it was a great way to learn some object-oriented programming. The thought process of creating classes with constructors and properties and methods is a considerable mental adjustment from a more basic functional programming approach, but I’m hoping it will be the gateway to learning more advanced programming in the future.

I may write more in the near future about this learning process, and about the apps and resources I have been using, but the result is a brand new version 2.0 of my Things Parser, completely rewritten using JavaScript classes and adding several significant new features. Before I get onto those, let me just summarise the basic syntax, which I’ve changed slightly from the previous version.

  • #Project Name
  • ==Heading
  • @Tag Name
  • //Note
  • !Natural Language Deadline
  • *Checklist Item1

Each of these, and combinations thereof, can be added after the name of the task and that information will be transferred to Things. Dates and reminders are automatically detected and parsed in natural language so no special characters are required. Here’s an example:

shopping tomorrow at 5pm #Personal
publish blog post today #Blog ==Drafts
presentation today !Friday #Work ==Meetings @Important *research *make presentation *follow up //Ask Bob’s opinion on this

The headline new feature is block-based entry. Previously to add a number of new tasks with the same metadata, you would need to add that information to each line. So for example you might write something like:

task 1 today
task 2 today
task 3 today

Now you can just write the following:

today
task 1
task 2
task 3

This works with all of the metadata previously supported so even things like this are possible

today at 5pm !Friday #Project ==Heading @Tag 1 @Tag 2 *checklist item 1 *checklist item 2 //note
task 1
task 2
task 3

If a task has metadata that conflicts with the block heading, the task’s metadata wins, but it will still inherit anything that doesn’t conflict. So things like this are fine:

#Project !Friday
Task 1
Task 2 !Monday
Task 3

Task 2 will be added to Project but will have a different deadline to the other tasks. Multiple blocks can be entered within a single draft and should be separated by a blank line.

The other big new feature is project creation. Using the new syntax +Project you can create a new project and add tasks to it. It works in two different modes: in-line and block-based. With the in-line mode you can just add +Project to the end of any line and it will create a new project with that task as the only entry. Headings can also be created, and an area can be specified. Any other metadata is assigned to the task.

task +Project ==Heading #Area today at 5pm !Friday

This creates a project called Project in Area with a heading and a single task under that heading. The task is assigned to today, has a reminder for 5pm, and has a deadline of Friday.

Block-based mode works in similar way with a couple of small changes: all metadata on the block heading is inherited by the new project, not the tasks, and multiple headings can be specified. Metadata must be specified for each task individually. If a task is given one of the headings specified in the block heading, it will be put under that heading, otherwise it will be assigned to the project with no heading.

+Project today at 5pm ==Heading 1 ==Heading 2 #Area @tag
Task with no heading
Task under heading 1 ==Heading 1
Task under heading 2 ==Heading 2

In this case, the date and tag will be added to the project, not the tasks.

It is possible to combine the project creation feature with the block-based task metadata inheritance using two blocks, one which creates the new project, and then another which adds tasks under it. So for example, if I wanted to create an important work project due on Friday with three tasks I wanted to work on today, I could do the following:

+Project #Work !Friday @Important

today #Project
task 1
task 2
task 3

I hope you enjoy using my script action. If you find any bugs or unexpected behaviour, you can let me know on Twitter. For more information on Drafts 5 more generally, check out the new site. If you’re interested in finding out about what other custom actions are available, have a look at the Action Directory, and if you want to talk to others about actions you’ve built or to get help, I’d encourage you to join the Drafts Community.

You can download Drafts 5 from the App Store, and you can download my Things Parser from the Action Directory.

  1. I have also added support for customising these special characters. Poke around in the script and you will see where you can change them. 

Things Parser for Drafts 5

2018-03-07✪Permalink

UPDATE: I’ve just released a version 2.0 of my Drafts Parser with new block-based entry and project creation features. You can read more about the update here.

I’ve had a lot of fun lately playing around with the beta of Drafts 5. The developer Greg Pierce of Agile Tortoise has been hard at work on a number of new features, notably developing and expanding the possibilities for JavaScript automation within the app. If you can pick up some JavaScript, there are some very powerful new things you can now do.

For example, I wrote a script to automatically add Markdown Links in reference style, complete with clipboard URL detection and automatically incrementing link reference numbers. You can add it to Drafts from the Drafts 5 Action Directory here.

Recently, I was reading Federico Viticci’s article on MacStories about Things automation. The Cultured Code team have recently updated Things with an advanced new URL scheme. In addition to a lot of new URL scheme actions, they added an add-json command which allows you to import a bunch of tasks or projects into Things with a single URL scheme action: no jumping back and forth between apps with repeated x-callback-URLs. Federico created a workflow which takes the content of the clipboard copied from a text editor, and assembles a chunk of JSON to send to Things. Each line of the text becomes a separate task, with special characters giving additional metadata about each task.

As part of its new scripting features, Drafts 5 added integration (via JavaScript) with this new add-json action, so this got me thinking about whether I could recreate Federico’s idea directly in JavaScript within Drafts.1 What I have ended up creating is a script which is completely compatible with his syntax, but expands upon it and makes it little more flexible.

First of all, it removes the need for the double backslash before the date and time of the event. I’ve built this script on top of a bit of JavaScript called Chrono. It’s a natural language parser that works for multiple languages and can detect references to dates automatically within a string. This means you can write things like “Tomorrow” or “Tuesday” anywhere in the line and it will pick that out as the day for the task. In addition, it will automatically set a reminder if (but only if) a time is also included.

In addition, I wanted my script to support all of the features that the Things add-json command supports, so as well as the special markup characters for projects, headings, tags, and notes, I’ve added characters for deadlines and checklist items. The full syntax is as follows:

  • #Project Name
  • ==Heading
  • @Tag Name
  • ++Note
  • !Deadline
  • *Checklist item

As with tag names in Federico’s workflow, multiple checklist items can be entered.

With this Drafts action, I can type multiple lines in the following format, and they are all simultaneously sent to the right place in Things.

Write blog post about Drafts and Things today at 4pm #Writing ==PolyMaths @drafts @things !Friday *drink espresso *write *publish

If you’re a Drafts user and want to use this script, you can only do so if you are on the Drafts 5 beta. If not, the full release of Drafts 5 should be coming soon, so watch out for that.

You can see my script here, and you can add it as action in Drafts by downloading this file.

  1. Of course, it is very simple to create an action that launches Federico’s workflow directly from within Drafts. Drafts has a native “Run Workflow” action step which you can use. 

OneDrive Updated with Drag & Drop and Files Support ↪︎

2018-01-30✪Permalink

John Voorhees, writing for MacStories:

Microsoft has released version 10.1 of its OneDrive app with support for drag and drop on the iPad and a new, cleaner design.

Drag and drop support allows users to move files and folders within the OneDrive app or drag files into and out of other apps. For example, users can drag photos from OneDrive into an email message to add as an attachment or drag attachments from messages into OneDrive. Users can also access their OneDrive files from Apple’s Files app.

Despite the advances the Files app has brought for dealing with multiple cloud services on iOS, the experience remains inconsistent. Dropbox offers probably the best integration so far, with Google’s half-hearted attempt lagging behind. For a long time, OneDrive looked like it wasn’t even trying, so it’s good to see them adding support for it in their latest update. For those in the Office 365 universe – which includes many teachers – I know that this will be a godsend. The Office apps on iOS also recently (and quietly) added drag & drop support, bringing them much closer to being full citizens of iOS 11.

Of course, the best integrated cloud service with the Files app is still iCloud Drive, part of the reason I consolidated most of my personal and work files there after iOS 11 came out. While I’ve been happy with my experience of going all in on iCloud Drive, I hope that iOS 12 and future updates bring more of an even playing field for cloud services on iOS.

Marking with Tally

2018-01-27✪Permalink

Life, the Universe, and Everything Tally is a really nice little utility that I only recently discovered. It’s made by Agile Tortoise, the developer of the wonderful Drafts app.

The concept is extremely simple: when you open the app, all you see is a large zero in the centre of the screen. When you tap on the screen, the zero becomes a one; each time you tap again, the number increments by one.

All of the other controls are gesture based. Swiping down decrements the number by one; swiping up reveals controls where you can adjust display settings and reset the counter to zero. Left and right swipes open menus where you can manage multiple tallies and change other settings.

Recently I found a really great use for Tally: counting marks in tests. When I’ve finished marking a set of tests, I go through and count up the total number of marks for each student. Now you might think that, being a maths teacher, I would be pretty good at counting, but it’s surprisingly easy to get distracted and lose count, or get out by ten. Sometimes I need to stop and re-mark something as I’m counting, and again it’s easy to lose count.

With Tally, I just have my phone on the desk by my left hand, and a red pen in my right hand. As I flick through the pages, I just tap on my phone screen. I can double or triple tap for multiple mark questions, and I don’t even need to be looking at the screen while I’m doing it. Using Tally in this way allows to me concentrate on reading the student’s work and my own marking. I can stop and make corrections without worrying about losing count. Even if I don’t need to make any corrections, I find I am much quicker and more accurate at counting the marks in this way, and as an added bonus I feel like I’m a World War II Morse code operator as I tap tap tap away.

With some tests, it’s easier to count the number of marks lost, and Tally supports this too. Using the sidebar on the right of the main screen, you can change the number to which the the counter resets and whether it counts up or down. So for a test out of 75 marks, I set the reset value to 75, and make the counter count down instead of up.

I can imagine many other uses for Tally in the classroom. Keeping track of merits or other student awards would be an obvious one, although Tally wouldn’t scale if like me you teach multiple classes. I would love to see Tally implement multiple collections of tallies, so that I could have one for each class, but I could understand why the developer, Greg Pierce, might be reluctant to complicate what is a beautifully simple app. On the other hand, Drafts, one of my very favourite apps, manages to combine absolute simplicity with the possibility for amazing levels of complexity, so perhaps that’s something that could be achieved with Tally as well.

Tally is a free download on the App Store with a £1.99 in-app purchase to unlock unlimited tallies and dark mode.

Slack for Teacher Collaboration

2018-01-20✪Permalink

Slack is a tool for teams that aims to simplify communication and collaboration. It’s marketed as a solution to many of the problems inherent in email, and as any teacher knows, school email is a problem very much in need of a solution!

Before I get into talking about how Slack can help teachers collaborate more effectively, it’s worth talking about why it’s necessary at all. What are the problems with email that need solving?

School Email

First and foremost, I think the major complaint most teachers have with school email is the sheer volume of it. I would argue, however, that it is not the volume of information that is the problem, but the lack of organisation and structure of that information. The nature of email is to be an undifferentiated mass of stuff, with messages which vary greatly in terms of their relevance, urgency, and importance. Almost all of the burden of filtering and sorting that deluge is placed upon the recipient, as you quickly come to realise when you leave your inbox unattended for too long.

I’ve recently started using some server-side email filtering rules to try to create a bit more order. I’ve set things up so that the emails which are directly relevant to me go straight to my inbox, whereas other emails are automatically sent to a folder, archived, or deleted. This has helped quite a bit, but it’s still very much my job to sort through everything.

Email also creates bad habits. I think a lot of people fall into the trap of using their email inbox as a de facto to do list. The model of the single inbox with a list of items which need to be dealt with encourages this, but for many reasons it’s a very bad idea. For one thing, it’s a to do list that other people can add things to whenever they want. To be productive you need to have control over setting your own priorities.

Email also falls done when it comes to collaboration. Long chains of messages organised around ad hoc subject lines is essentially a hack which has been grafted on top of an ancient protocol. Finding and searching through emails on a particular topic is difficult, as they will often be split across several different subject lines. If someone new becomes involved in a project and they were not one of the original recipients of the emails, someone needs to forward the whole messy and fragmented email chain to them.

Slack

Slack solves many of these problems. While it doesn’t necessarily reduce the volume of information, it does impose a structure on it. Within a Slack “workspace”, messages are organised into “channels”, signified by hashtags. You start with two channels: #general and #random for team-wide announcements and casual chat respectively, and you can then create other channels focussed around particular topics. Members of your team can choose which subset of channels is relevant to them, and can even adjust their notifications on a per-channel basis.

The channel structure is a far better solution for organising discussion around a particular topic than email subject lines. It places the burden primarily on the sender to decide where they should post their message, and for the recipient, all messages received are pre-sorted into topic areas. Senders can also fine-tune the relevance of their messages using mentions. By including the @username of one or more members of the team in their message, the sender can indicate in a more precise way exactly those people for whom it is relevant. On the recipient’s side, these messages are highlighted.

Another strength of Slack is the level of customisation of notifications that’s possible. By tweaking the settings, if you want, you can only receive a ping when you are specifically mentioned in a message. That way you can be getting on with work and only be notified when a message specifically requires your attention. You can even snooze all notifications to get some quiet time.

Slack also solves the problem of the inbox as a to do list. Slack has no inbox, so as the recipient you need to be proactive in deciding which messages require action. Email is essentially an opt-out system: you need to delete or archive messages which do not require action, leaving behind the ones that do. Slack, on the other hand, is an opt-in systems: as the conversation flows, you decide what you need to capture and act on. If it’s not relevant, you don’t need to do anything: you simply let the messages disappear up the timeline. In my experience, taking control in this way makes you a much less stressed and much more productive person. This may be an adjustment for those who are not used to having to have a separate place to capture things, but it leads to far healthier habits in the long run. You can do this within Slack in a basic way by starring messages, but my recommendation would be to get things that require action into a task management system that you trust and maintain.

Slack is also built from the ground up for collaboration. Sending messages, attaching files, and replying to other people is quick and easy. There‘s a lot less friction than with email, where decisions need to be made about recipients, subject lines, CCs, and BCCs. This reduction in friction might well increase the volume of messages being sent, but I would argue that this is for a good reason. Considerate users of email minimise the number of recipients and the number of messages because they know that, by sending it, they are giving everyone who receives it a task to do. This can actually have the effect of discouraging collaboration: you are reluctant to send a message unless is is genuinely important. With Slack on the other hand, there is little cost to others if your message is less relevant or less interesting to them.

Slack in School

Slack in School In my school I’ve piloted the use of Slack within the Mathematics Department. Primarily we use it for sharing teaching resources. We have a channel for each of the year groups, so that teachers can join the channels for the classes they teach. Another really helpful use we’ve found is for discussion around marking tests. We are often doing these separately at home, and it’s good to be able to chat about the mark scheme and post photos of student answers that we are unsure how to mark.

One of the concerns other teachers have about using a tool like Slack for collaboration is that it’s just another place to check. That concern is legitimate: unless using two different tools offers significant advantages, it’s inconvenient to have to use them in parallel. However, in my experience, collaboration within a subject department is distinct enough from whole-school email that a division between the two isn’t disruptive, and as I’ve argued above, Slack is a significantly more powerful tool for effective collaboration.

While I think Slack works best in teams that work together day to day, it’s interesting to think about how it might work on a whole-school level, and whether it could completely replace email.1 There are big companies which use Slack, so it does scale to that level. At the high school level, it would need to be organised around subject departments, and since each subject would probably require multiple channels, there would probably have to be some oversight to ensure there was a consistent naming scheme for channels, among other things.

Alternatives to email are becoming widespread in the corporate and charity sector2, and it’s about time that schools started experimenting with some of these tools as well. Teaching is a profession where effective collaboration is not always a given, but in my experience sharing ideas and resources with other teachers is one of the most fulfilling parts of the job. On its own, Slack is not going to magically create a collaborative environment in a school, but it can certainly enhance what’s there. If you’re looking for a better tool for your school, why not give Slack a go?

  1. I would love a #lostproperty channel that I could completely ignore. 

  2. My church is all in on Slack.