This is single.php

Two Useful Tools To Speed Up Your Code Workflow - alfred-keyboard-maestro-butler.png

This is content-single.php

Two Useful Tools To Speed Up Your Code Workflow

Alfred 2 Keyboard Maestro

 

Sherlock Holmes once said that he tried not to clutter his brain with useless things…

while reserving space for the useful…

The rest of us aren’t like Holmes because we can’t remember everything and neither should we.

That’s what Google and the Internet is for.

Yet programmers and developers need to remember what X and Y does… and it doesn’t help if you have to remember the rarely used pieces of code that take 5, 10 or 15 minutes to look up.

Well there’s an answer to that.

Use tools like Alfred 2 or Keyboard Maestro to speed up your workflow.  

Call it “digital delegation”.

Note that Alfred and Maestro are both Mac only applications, Windows developers. 




 

How Does Alfred 2 Help?

In my workflow Alfred helps as an application launcher, calculator, clippings and a snippet box.  

 

Now I don’t have to hunt for an app by clicking through several windows.

The same goes for finding specific files.

In Mac OS X Yosemite Spotlight has copied much of Alfred 2’s functionality however I still prefer Alfred.  

It’s an inertia thing.

 

The calculator function lets you do math in the launch bar that pops up when you bring up Alfred 2.  

I use it often to convert pixels to ems by dividing the value by 16 and pasting it into Sublime Text SCSS files.

This is far more convenient than opening another calculator app or trying to do it in your head.

 

The clippings feature is under Features > Clipboard and I use it more than any other feature.  

Copying a SCSS or Javascript variable or value over and over?

Just type “clip” in Alfred and it shows you all the things you’ve cut and pasted for up to a few months (or whatever you set it as).

I find I use this feature constantly especially when I don’t want to reference my typography.scss file for the $basefontsize variable or a specific theme colour.

 

The Alfred 2 snippets are also found under Features > Clipboard.  

I mainly use it to remember links (<link>) and scripts (<script>) for Font Awesome, jQuery and other CDN links.  

That saves a few more minutes every time I’m working on a new project (otherwise I include it in my current project template).

The Alfred 2 snippets aren’t perfect in that it’s hard to auto-indent it when pasted into Sublime Text.

It takes some trial and error with some snippets because of the indentation.

So if you have a piece of code you use often and it’s indented… and you copy it into a snippet in Alfred 2 and then paste it from Alfred… the indenting will be all wrong.

Which may drive those with OCD nuts…

 

Another powerful benefit of Alfred are the workflows that others have built.  

Need to convert units?

Someone out there has likely created a work flow for that.  

Do you use Dash?

There’s a workflow you can import that lets you search your Dash app for documentation entries.

My favourite workflow is the one for Font Awesome that lets you search out the class to slap onto an html element so you have an icon (see the resources below).

 

Some of Alfred 2’s features are only available if you’ve purchased their $15 USD power pack…

I believe the most useful ones however don’t require Power Pack.

 

Now what about Maestro…?

 

How Does Keyboard Maestro Help?

Keyboard Maestro is Alfred 2 snippet power on steroids.

It has a bit of a learning curve however you can customize to not just cut and paste — it can actually “type” out text as if it were you

 

This partly solves issues of cutting and pasting code into Sublime Text.

 

You can even make it use the same hot keys Sublime Text uses to “Cut and Indent” so that everything is lined up instantly.

There are so many possible ways to do it that it’s insane.

You can set hot keys, set “typed text” triggers (i.e. I type “jon” and it writes out an entire email to Jon from a template) and more.

It actually helps me break up my code because it makes commenting easier.

I create entire templates of “comment sections” where I insert my code between the comment start and end marks.

Like writing good ad copy, you write better code by “breaking” things up with “comment space” — complete with comment headings like “Header”, “Footer”, “Navbar”…

 

Unlike Alfred, Keyboard Maestro doesn’t quite have the kind of community that provides the “macros’ the way the Alfred community provides “workflows” so you may not always find a solution to your problem the way you might with Alfred.

 

You could use Sublime Text’s snippets function which is under Tools > Snippets… and if you code only in Sublime Text then sure I guess that’s fine.

I’ve always found it somewhat glitchy unless you don’t try to limit Sublime Text’s source file… meaning you don’t say the snippet only works in certain types of files like HTML.

 



Still I prefer to have my snippets in a kind of universal space that I can use anywhere on my computer — like email or for writing ads or marketing content.

 

The bottom line is that a developer shouldn’t try to remember every little detail and instead use “external memory” (a Ghost in the Shell reference) to manage the small yet useful things that you need for your projects.

 

Later on I’ll probably chat about more specific tactics and techniques as I’m only scratching the surface of what they might do for you.

For now investigate these two tools and see how they can help you.

I’ve included some resources below.

 

Cheers,

Sunny Lam

 

Alfred 2 Select Resources

Alfred 2 Workflows I use Everyday by Jan Beck 

Alfred 2 Font Awesome Workflow (for developers this one is one you can’t live without) 

Alfred 2 Workflow To “Switch” On Keyboard Maestro Macros (without using Maestro’s own launcher)

 

Keyboard Maestro Select Resources

Keyboard Maestro Examples by Sayzlim

Keyboard Maestro on Mac Automation Tips

 

 

Photo Credit:  www.audio-luci-store.it

Comments insertion starts here.

Leave a Reply